1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-10-09 23:57:26 -04:00

fix issue with heatmap bounds not working correctly

This commit is contained in:
Evan Pezent 2020-07-25 07:52:15 -05:00
parent 7a4bb510fb
commit 0a3442f389
2 changed files with 4 additions and 2 deletions

View File

@ -3221,7 +3221,7 @@ void RenderHeatmap(Transformer transformer, ImDrawList& DrawList, const T* value
for (int c = 0; c < cols; ++c) { for (int c = 0; c < cols; ++c) {
ImPlotPoint p; ImPlotPoint p;
p.x = bounds_min.x + 0.5*w + c*w; 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 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); 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)); float t = (float)Remap(values[i], scale_min, scale_max, T(0), T(1));

View File

@ -412,8 +412,10 @@ void ShowDemoWindow(bool* p_open) {
ImGui::SameLine(); ImGui::SameLine();
static ImVec4 gray[2] = {ImVec4(0,0,0,1), ImVec4(1,1,1,1)}; static ImVec4 gray[2] = {ImVec4(0,0,0,1), ImVec4(1,1,1,1)};
ImPlot::SetColormap(&gray[0], 2); ImPlot::SetColormap(&gray[0], 2);
ImPlot::SetNextPlotLimits(-1,1,-1,1);
if (ImPlot::BeginPlot("##Heatmap2",NULL,NULL,ImVec2(225,225),ImPlotFlags_ContextMenu,0,0)) { 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::EndPlot();
} }
ImPlot::SetColormap(ImPlotColormap_Default); ImPlot::SetColormap(ImPlotColormap_Default);