epezent / implot

Immediate Mode Plotting
MIT License
4.65k stars 517 forks source link

Vertical bar plots with x-axis log scale -- how to compute bar width? #375

Open jgarvin opened 2 years ago

jgarvin commented 2 years ago

The PlotBars methods seem to expect the width to be specified in plot space, but on a log scale that doesn't make sense, because your bars will be inconsistent sizes. Is there a trick for this?

epezent commented 2 years ago

It's not currently possible. matplotlib also suffers from this issue, and the recommended solution there is to pass an array of variable bar widths. We don't support that yet.

Your best bet will be to implement your own bar renderer using custom draw calls. Take a look at the PlotCandlestick example in the demo to see how it's done: https://github.com/epezent/implot/blob/fc0fd112467c2be84bc56daa57612b0c579ff1af/implot_demo.cpp#L2380-L2439

jgarvin commented 2 years ago

Thanks I will take a look 👍

Bladieblah commented 9 months ago

Bump