MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / Demo_ErrorBars

Function Demo_ErrorBars

Source/3rdParty/implot/implot_demo.cpp:648–680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

646//-----------------------------------------------------------------------------
647
648void Demo_ErrorBars() {
649 IMGUI_DEMO_MARKER("Plots/Error Bars");
650 static float xs[5] = {1,2,3,4,5};
651 static float bar[5] = {1,2,5,3,4};
652 static float lin1[5] = {8,8,9,7,8};
653 static float lin2[5] = {6,7,6,9,6};
654 static float err1[5] = {0.2f, 0.4f, 0.2f, 0.6f, 0.4f};
655 static float err2[5] = {0.4f, 0.2f, 0.4f, 0.8f, 0.6f};
656 static float err3[5] = {0.09f, 0.14f, 0.09f, 0.12f, 0.16f};
657 static float err4[5] = {0.02f, 0.08f, 0.15f, 0.05f, 0.2f};
658
659
660 if (ImPlot::BeginPlot("##ErrorBars")) {
661 ImPlot::SetupAxesLimits(0, 6, 0, 10);
662
663 ImPlot::PlotBars("Bar", xs, bar, 5, 0.5f);
664 ImPlot::PlotErrorBars("Bar", xs, bar, err1, 5);
665
666 ImPlot::PlotErrorBars("Line", xs, lin1, err1, err2, 5, {ImPlotProp_LineColor, GetColormapColor(1), ImPlotProp_Size, 0});
667 ImPlot::PlotLine("Line", xs, lin1, 5, {ImPlotProp_Marker, ImPlotMarker_Square});
668
669 ImPlotSpec spec;
670 spec.LineColor = GetColormapColor(2);
671 spec.Size = 6;
672 spec.LineWeight = 1.5f;
673 ImPlot::PlotErrorBars("Scatter", xs, lin2, err2, 5, spec);
674 spec.Flags = ImPlotErrorBarsFlags_Horizontal;
675 ImPlot::PlotErrorBars("Scatter", xs, lin2, err3, err4, 5, spec);
676 ImPlot::PlotScatter("Scatter", xs, lin2, 5);
677
678 ImPlot::EndPlot();
679 }
680}
681
682//-----------------------------------------------------------------------------
683

Callers

nothing calls this directly

Calls 8

BeginPlotFunction · 0.85
SetupAxesLimitsFunction · 0.85
PlotBarsFunction · 0.85
PlotErrorBarsFunction · 0.85
GetColormapColorFunction · 0.85
PlotLineFunction · 0.85
PlotScatterFunction · 0.85
EndPlotFunction · 0.85

Tested by

no test coverage detected