From fa23f04faecb1f48925377223f45bbc2ea1d257e Mon Sep 17 00:00:00 2001 From: silvana Date: Thu, 28 Sep 2023 09:44:29 +0200 Subject: [PATCH] Add colourmap to heatmap --- src/heatmap.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/heatmap.rs b/src/heatmap.rs index 2a023b7..b6f14d9 100644 --- a/src/heatmap.rs +++ b/src/heatmap.rs @@ -1,4 +1,7 @@ -use sys::{ImPlotHeatmapFlags, ImPlotHeatmapFlags__ImPlotHeatmapFlags_ColMajor}; +use sys::{ + ImPlotColormap__ImPlotColormap_Viridis, ImPlotHeatmapFlags, + ImPlotHeatmapFlags__ImPlotHeatmapFlags_ColMajor, +}; use crate::sys; use std::ffi::CString; @@ -24,14 +27,15 @@ impl PlotHeatmap { } unsafe { + sys::ImPlot_PushColormap_PlotColormap(ImPlotColormap__ImPlotColormap_Viridis as i32); sys::ImPlot_PlotHeatmap_doublePtr( self.label.as_ptr() as *const c_char, x.as_ptr(), rows, cols, 0.0, - 0.0, - "\0".as_ptr() as *const c_char, + 1.0, + "%.0f\0".as_ptr() as *const c_char, ImPlotPoint { x: 0f64, y: rows as f64,