epezent / implot

Immediate Mode Plotting
MIT License
4.78k stars 531 forks source link

shaded stairs plot? #357

Closed phraktle closed 2 years ago

phraktle commented 2 years ago

Is there a way to show a shaded stairs plot? The closest I was able to get visually was to show a stairs plot with a semi-transparent shaded plot underneath, but that has some obvious visual artifacts, as in this screenshot:

screenshot
epezent commented 2 years ago

The best solution I can currently offer is to insert additional points to the data you pass to PlotShaded. I think it's actually a good idea to add e.g. a PlotSairsShaded API function to do what you want, though. I can flag this for future work.

phraktle commented 2 years ago

Thanks, indeed as a workaround one could calculate the connecting points. It would be more convenient and performant to have the PlotSairsShaded call available (or perhaps a more general API to specify the fill and the line styles).

epezent commented 2 years ago

Hi, https://github.com/epezent/implot/commit/fc0fd112467c2be84bc56daa57612b0c579ff1af adds ImPlotStairsFlags_Shaded:

image

phraktle commented 2 years ago

Awesome, thanks!