github epezent/implot v1.0

10 hours ago

Hi everyone! Happy new year 🎉

After 6 years of development, I'm thrilled to finally announce ImPlot v1.0.

This major milestone reflects the library's maturity and stability, and wouldn't have been possible without the incredible work of @epezent -- who created ImPlot and shaped it into what it is today -- and the countless contributors who helped along the way. Thank you all!

v1.0 introduces ImPlotSpec, a redesigned public API more aligned with modern plotting library conventions, along with the long-awaited support for per-point custom colors and sizes. We hope you enjoy the new API as much as we do!

🚀 New Features

  • Feat: Add ImPlotSpec and remove existing plot item styling mechanisms by @epezent in #519

    • We introduce ImPlotSpec, a new way to specify the plot styling which better resembles other plotting libraries.
    • There are two ways to use ImPlotSpec:
      • Usage Option 1 -- By declaring and defining a struct instance:
      ImPlotSpec spec;
      spec.LineColor = ImVec4(1,1,0,1);
      spec.LineWeight = 1.0f;
      spec.FillColor = ImVec4(1,0.5f,0,1);
      spec.FillAlpha = 0.5f;
      spec.Marker = ImPlotMarker_Square;
      spec.MarkerSize = 6;
      spec.Stride = sizeof(ImVec2);
      spec.Flags = ImPlotItemFlags_NoLegend | ImPlotLineFlags_Shaded;
      ImPlot::PlotLine("Line 1", &data1[0].x, &data1[0].y, 20, spec);
      • Usage Option 2 -- Inline using ImPlotProp,value pairs (order does NOT matter):
      ImPlot::PlotLine("Line 2", &data2[0].x, &data2[0].y, 20, {
          ImPlotProp_LineColor, ImVec4(0,1,1,1),
          ImPlotProp_LineWeight, 1.0f,
          ImPlotProp_FillColor, ImVec4(0,0,1,1),
          ImPlotProp_FillAlpha, 0.5f,
          ImPlotProp_Marker, ImPlotMarker_Diamond,
          ImPlotProp_MarkerSize, 6,
          ImPlotProp_Stride, sizeof(ImVec2),
          ImPlotProp_Flags, ImPlotItemFlags_NoLegend | ImPlotLineFlags_Shaded
      });

      image

  • Feat: Per-Index Color/Size Support with ImPlotSpec by @brenocq in #672

    image image

    image image

  • Feat: PlotPolygon by @brenocq in #673

    // Plots a polygon. Points are specified in counter-clockwise order. If concave, make sure to set the Concave flag.
    IMPLOT_TMP void PlotPolygon(const char* label_id, const T* xs, const T* ys, int count, const ImPlotSpec& spec=ImPlotSpec());

    image

  • Feat: Added PlotBubbles by @Luc16 in #611

    // Plots a bubble graph. #szs are the radius of each bubble in plot units.
    IMPLOT_TMP void PlotBubbles(const char* label_id, const T* values, const T* szs, int count, double xscale=1, double xstart=0, const ImPlotSpec& spec=ImPlotSpec());
    IMPLOT_TMP void PlotBubbles(const char* label_id, const T* xs, const T* ys, const T* szs, int count, const ImPlotSpec& spec=ImPlotSpec());
    

    image

  • Feat: A brand new manual, including ImGui, ImPlot and ImPlot3D!!! by @pthom in #683

  • Feat: Add ImPlotPieChartFlags_NoSliceBorder and custom pie renderers by @brenocq in #679

🐛 Bug Fixes | 📄 Docs

📦 ImPlot3D v0.4 Released

Today we are also releasing ImPlot3D v0.4.

ImPlot3D is an extension of ImPlot designed for high-performance 3D visualization. It shares the same API philosophy as ImPlot and ImGui, making it easy to integrate into your existing projects. v0.4 brings improved axis interaction area, ImPlot3DSpec API, and per-index coloring/sizing.

image image

image image

🙌 Show and tell

@Prinkesh released nbimplot: a Jupyter-native plotting library built around ImPlot interaction quality and WASM performance.

image

⚠️ Breaking Changes

SetNextXXX API was deprecated in favor of ImPlotSpec API

  • SetNextLineStyle has been removed, styling should be set via ImPlotSpec.

    // Before
    ImPlot::SetNextLineStyle(line_color, line_weight);
    ImPlot::PlotLine("Line", xs, ys, count);
    
    // After
    ImPlotSpec spec;
    spec.LineColor = line_color;
    spec.LineWeight = line_weight;
    ImPlot::PlotLine("Line", xs, ys, count, spec);
  • SetNextFillStyle has been removed, styling should be set via ImPlotSpec.

    // Before
    ImPlot::SetNextFillStyle(fill_color, fill_alpha);
    ImPlot::PlotLine("Shaded", xs, ys, count, ImPlotLineFlags_Shaded);
    
    // After
    ImPlotSpec spec;
    spec.FillColor = fill_color;
    spec.FillAlpha = fill_alpha;
    spec.Flags = ImPlotLineFlags_Shaded;
    ImPlot::PlotTLine("Shaded", xs, ys, count, spec);
  • SetNextMarkerStyle has been removed, styling should be set via ImPlotSpec.

    // Before
    ImPlot::SetNextMarkerStyle(marker, marker_size, fill_color, line_weight, marker_outline_color);
    ImPlot::PlotScatter("Scatter", xs, ys, count);
    
    // After
    ImPlotSpec spec;
    spec.LineWeight = line_weight;
    spec.Marker = marker;
    spec.MarkerSize = marker_size;
    spec.MarkerLineColor = marker_outline_color;
    spec.MarkerFillColor = fill_color;
    ImPlot::PlotScatter("Scatter", xs, ys, count, spec);
  • SetNextErrorBarStyle has been removed, styling should be set via ImPlotSpec.

    // Before
    ImPlot::SetNextErrorBarStyle(color, size, weight);
    ImPlot::PlotErrorBars("ErrorBar", xs, ys, err, count);
    
    // After
    ImPlotSpec spec;
    spec.LineColor = color;
    spec.Size = size;
    spec.LineWeight = weight;
    ImPlot::PlotErrorBars("ErrorBar", xs, ys, err, count, spec);
  • Flags, Offset and Stride should also be set via ImPlotSpec now.

🎉 New Contributors

Full Changelog: v0.17...v1.0

Don't miss a new implot release

NewReleases is sending notifications on new releases.