Hello!
I've modified example Demo_CustomStyles to test NextColormapColor function:
void Demo_CustomStyles() {
ImPlot::PushColormap(ImPlotColormap_Deep);
// normally you wouldn't change the entire style each frame
ImPlotStyle backup = ImPlot::GetStyle();
MyImPlot::StyleSeaborn();
if (ImPlot::BeginPlot("seaborn style")) {
ImPlot::SetupAxes( "x-axis", "y-axis");
ImPlot::SetupAxesLimits(-0.5f, 9.5f, 0, 10);
unsigned int lin[10] = {8,8,9,7,8,8,8,9,7,8};
unsigned int bar[10] = {1,2,5,3,4,1,2,5,3,4};
unsigned int dot[10] = {7,6,6,7,8,5,6,5,8,7};
ImPlot::PlotBars("Bars", bar, 10, 0.5f);
ImPlot::PlotLine("Line", lin, 10);
ImPlot::TagX(4, ImPlot::NextColormapColor()); // skip green
ImPlot::PlotScatter("Scatter", dot, 10);
ImPlot::EndPlot();
}
ImPlot::GetStyle() = backup;
ImPlot::PopColormap();
}
I added TagX at position 4 and want it to have color assigned automatically (it should be green as it was skipped in the original example).
But what I get is it changes color on every frame.
Have I misunderstood purpose of this function? And how should I get next avaliable color for Plot?
I know about GetColormapColor with indexed access but this would require some additional index keeping.
Hello! I've modified example
Demo_CustomStyles
to testNextColormapColor
function:I added
TagX
at position 4 and want it to have color assigned automatically (it should be green as it was skipped in the original example). But what I get is it changes color on every frame.Have I misunderstood purpose of this function? And how should I get next avaliable color for Plot?
I know about
GetColormapColor
with indexed access but this would require some additional index keeping.