| 886 | //----------------------------------------------------------------------------- |
| 887 | |
| 888 | void Demo_Histogram2D() { |
| 889 | IMGUI_DEMO_MARKER("Plots/Histogram 2D"); |
| 890 | static int count = 50000; |
| 891 | static int xybins[2] = {100,100}; |
| 892 | |
| 893 | static ImPlotHistogramFlags hist_flags = 0; |
| 894 | |
| 895 | ImGui::SliderInt("Count",&count,100,100000); |
| 896 | ImGui::SliderInt2("Bins",xybins,1,500); |
| 897 | ImGui::SameLine(); |
| 898 | ImGui::CheckboxFlags("Density", (unsigned int*)&hist_flags, ImPlotHistogramFlags_Density); |
| 899 | |
| 900 | static NormalDistribution<100000> dist1(1, 2); |
| 901 | static NormalDistribution<100000> dist2(1, 1); |
| 902 | double max_count = 0; |
| 903 | ImPlotAxisFlags flags = ImPlotAxisFlags_AutoFit|ImPlotAxisFlags_Foreground; |
| 904 | ImPlot::PushColormap("Hot"); |
| 905 | if (ImPlot::BeginPlot("##Hist2D",ImVec2(ImGui::GetContentRegionAvail().x-100-ImGui::GetStyle().ItemSpacing.x,0))) { |
| 906 | ImPlot::SetupAxes(nullptr, nullptr, flags, flags); |
| 907 | ImPlot::SetupAxesLimits(-6,6,-6,6); |
| 908 | max_count = ImPlot::PlotHistogram2D("Hist2D",dist1.Data,dist2.Data,count,xybins[0],xybins[1],ImPlotRect(-6,6,-6,6), {ImPlotProp_Flags, hist_flags}); |
| 909 | ImPlot::EndPlot(); |
| 910 | } |
| 911 | ImGui::SameLine(); |
| 912 | ImPlot::ColormapScale(hist_flags & ImPlotHistogramFlags_Density ? "Density" : "Count",0,max_count,ImVec2(100,0)); |
| 913 | ImPlot::PopColormap(); |
| 914 | } |
| 915 | |
| 916 | //----------------------------------------------------------------------------- |
| 917 |
nothing calls this directly
no test coverage detected