I'm creating a Voronoi tree map using R and I want to save the map as a JPG or PNG image with high resolution in order to publish it in a journal. Below I reported my script to generate the map, could someone help me to modify the scripp adding line to save the map? Thank you for your help.
library(voronoiTreemap)
library(scales)
data<-read.csv("C:/File_script/2-subfamily-gene-regions-population-percentage-voronoi.csv", sep=",", header=T)
data$h1<-as.character(data$h1)
data$h2<-as.character(data$h2)
data$h3<-as.character(data$h3)
data$color<-as.character(data$color)
data$weight<-as.numeric(data$weight)
data$codes<-as.character(data$codes)
dataH <- vt_input_from_df(data)
plot <- vt_d3(vt_export_json(dataH), legend =FALSE, color_circle = "#080708", color_border = "#ffffff")
I leave also an example that you can replicated and try to save.
data(canada)
canada$codes <- canada$h3
canada <- canada[canada$h1=="Canada",]
canadaH <- vt_input_from_df(canada,scaleToPerc = FALSE, hierachyVar0 = "h1",
hierachyVar1 = "h2", hierachyVar2 = "h3", colorVar = "color", labelVar = "codes",
weightVar = "weight")
canadaH <- vt_input_from_df(canada,scaleToPerc = FALSE)
vt_d3(vt_export_json(canadaH))