[R] Save the result of map.market function to HTML file?

Jim Lemon drjimlemon at gmail.com
Wed Jun 3 02:29:31 CEST 2015


Hi valerio,
This is a guess, but try running your code with "htmlize" (prettyR).
Change the "pdf" call to:

png("C:/Users/Administrator/Desktop/treemap1.png")
map.market(id = data1$Id, area = data1$size, group = data1$Storage,
 color = data1$col, lab=c(TRUE,TRUE), main="Test Map")
dev.off()
png("C:/Users/Administrator/Desktop/treemap2.png")
map.market(id = data2$Id, area = data2$size, group = data2$Storage,
 color = data2$col, lab=c(TRUE,TRUE), main="Test Map")
dev.off()
png("C:/Users/Administrator/Desktop/treemap3.png")
map.market(id = data3$Id, area = data3$size, group = data3$Storage,
 color = data3$col, lab=c(TRUE,TRUE), main="Test Map")
dev.off()

as I think you are producing three images.

# assume the code above is in a file "vo.R" in the R working directory
library(prettyR)
htmlize("vo.R")

This should produce a file "vo.html" with the plots in it.

Jim

On Wed, Jun 3, 2015 at 1:49 AM, valerio orfano <ingorfano at hotmail.com> wrote:
> HI All,
>
> i need to call the tree map function in R to display my multiple disks usage, using ‘portfolio' library. I need furthermore to generate multiple page each showing the treemap of each disk. It works fine if use pdf file , but my boss wants to save the result into an html file. Any help? I’ve tried with R2HTML library without success. The output of map.market is a ‘gTree' object. Any help is appreciated.
>
> library(portfolio)
> data1 <- read.csv("C:/Users/Administrator/Desktop/prova_data1.txt", sep='\t', stringsAsFactors = FALSE)
> data2 <- read.csv("C:/Users/Administrator/Desktop/prova_data2.txt", sep='\t', stringsAsFactors = FALSE)
> data2 <- read.csv("C:/Users/Administrator/Desktop/prova_data3.txt", sep='\t', stringsAsFactors = FALSE)
> pdf("C:/Users/Administrator/Desktop/treemap.pdf")
> map.market(id = data1$Id, area = data1$size, group = data1$Storage, color = data1$col, lab=c(TRUE,TRUE), main="Test Map")
> map.market(id = data2$Id, area = data2$size, group = data2$Storage, color = data2$col, lab=c(TRUE,TRUE), main="Test Map")
> map.market(id = data3$Id, area = data3$size, group = data3$Storage, color = data3$col, lab=c(TRUE,TRUE), main="Test Map")
> dev.off()
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list