简体   繁体   English

将d3heatmap图像保存在文件中

[英]save image of d3heatmap in a file

I am using d3heatmap package in R for to draw heatmaps. 我在R中使用d3heatmap软件包绘制热图。 When I use it in Rstudio, I can save images that it produces by choosing save image from the viewer menu. 在Rstudio中使用它时,可以通过从查看器菜单中选择“保存图像”来保存它产生的图像。 I am wondering how I can save the heatmap to a file in an Rscript. 我想知道如何将热图保存到Rscript中的文件中。 Apparently, png(filename) does not work. 显然,png(filename)不起作用。

A potential approach is using htmlwidgets and save it in html form only since the d3heatmap returns object of class "d3heatmap" "htmlwidget" 一种可能的方法是使用htmlwidgets并将其保存为html格式,因为d3heatmap返回类“ d3heatmap”和“ htmlwidget”的对象

EG. 例如。

library(htmlwidgets)
data(mtcars)
map <- d3heatmap(mtcars, scale = "column")
saveWidget(map, "test.html")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM