Hello!
I have done a plot with the heatmap() function in R studio and now I'm having a lot of issues trying to save it .
I normally do my plots with ggplot and save them with ggsave, pretty simple. However, with heatmap I have not found such a straight forward function.
I have tried to ask chatGTP and it gives me the functions os svglite () or svg(), but, non of them work. I have tried these codes:
svg("Order_vaer_heatmap.svg", width = 8, height = 6)
draw(Order_vaer)
dev.off()
svglite::svglite(file = "Order_vaer.svg", width = 8, height = 6, {
- draw(Order_vaer)*
})
dev.off()
It always gives me the error of
Error in dev.off() : cannot shut down device 1 (the null device)
I also have had the error of Warning in cairoVersion() :
- unable to load shared object '/Library/Frameworks/R.framework/Resources/library/grDevices/libs//cairo.so':*
Does anyone knows how to easily save a heatmap plot? I feel like there must be an easier way to do it.
Thank you!