mirror of
https://github.com/gwm17/implot.git
synced 2025-01-30 10:58:51 -05:00
fix issue with heatmap bounds not working correctly
This commit is contained in:
parent
7a4bb510fb
commit
0a3442f389
|
@ -3221,7 +3221,7 @@ void RenderHeatmap(Transformer transformer, ImDrawList& DrawList, const T* value
|
|||
for (int c = 0; c < cols; ++c) {
|
||||
ImPlotPoint p;
|
||||
p.x = bounds_min.x + 0.5*w + c*w;
|
||||
p.y = bounds_min.y + 1 - (0.5*h + r*h);
|
||||
p.y = bounds_max.y - (0.5*h + r*h);
|
||||
ImVec2 a = transformer(p.x - half_size.x, p.y - half_size.y);
|
||||
ImVec2 b = transformer(p.x + half_size.x, p.y + half_size.y);
|
||||
float t = (float)Remap(values[i], scale_min, scale_max, T(0), T(1));
|
||||
|
|
|
@ -412,8 +412,10 @@ void ShowDemoWindow(bool* p_open) {
|
|||
ImGui::SameLine();
|
||||
static ImVec4 gray[2] = {ImVec4(0,0,0,1), ImVec4(1,1,1,1)};
|
||||
ImPlot::SetColormap(&gray[0], 2);
|
||||
ImPlot::SetNextPlotLimits(-1,1,-1,1);
|
||||
if (ImPlot::BeginPlot("##Heatmap2",NULL,NULL,ImVec2(225,225),ImPlotFlags_ContextMenu,0,0)) {
|
||||
ImPlot::PlotHeatmap("heat",values2,100,100,0,1,NULL);
|
||||
ImPlot::PlotHeatmap("heat1",values2,100,100,0,1,NULL);
|
||||
ImPlot::PlotHeatmap("heat1",values2,100,100,0,1,NULL, ImPlotPoint(-1,-1), ImPlotPoint(0,0));
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
ImPlot::SetColormap(ImPlotColormap_Default);
|
||||
|
|
Loading…
Reference in New Issue
Block a user