You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Question: For further processing, I need to save the heatmap plot as an image, but when trying to save, white fields are always formed at the edges. How can I fix the code so that I can get an image containing only a graph of a heatmap without extraneous elements?
UPD. At the moment, I found out that the DataBackground field from BackgroundStyle class is responsible for this frame. I was able to change its color, but I need to completely exclude it.
swharden
changed the title
How i can save HeatMap Plot as image without white fields using ScottPlot 5
Heatmap: still has white border when "frameless" mode is enabled
May 14, 2024
Thanks for reporting this @itsmygam3! I suspect this issue relates to axes taking several pixels even though frameless is enabled, but an not 100% sure yet. I'll take a look at this eventually, but if someone from the open source community is able to take a closer look first and creates a PR to fix the problem, I will be happy to review and merge it in good time 👍
I confirmed this is a heatmap issue (not an axis padding issue) because setting the data area background color shows the heatmap is not filling the whole data area
Actually, I figured it out! Plots have a little bit of padding (margins) around the data area by deafault. Disabling this gets the functionality you're seeking:
double[,]data={{1,2,3},{4,5,6},{7,8,9}};
ScottPlot.Plot plot=new();
plot.DataBackground.Color = ScottPlot.Colors.Magenta;
plot.Axes.Margins(0,0);// <------ SET MARGIN TO ZERO
plot.Add.Heatmap(data);
plot.Layout.Frameless();
plot.SaveJpeg("bord.jpg",400,400).LaunchFile();
I'll leave this issue open to track adding an example to the cookbook
swharden
changed the title
Heatmap: still has white border when "frameless" mode is enabled
Cookbook: add recipe showing frameless heatmap
May 14, 2024
Question: For further processing, I need to save the heatmap plot as an image, but when trying to save, white fields are always formed at the edges. How can I fix the code so that I can get an image containing only a graph of a heatmap without extraneous elements?
UPD. At the moment, I found out that the
DataBackground
field fromBackgroundStyle
class is responsible for this frame. I was able to change its color, but I need to completely exclude it.ScottPlot Version: 5.0.34
Code Sample:
The text was updated successfully, but these errors were encountered: