Hi valerio, This is a great coincidence. I have been working on exactly this problem in an analysis I have been conducting. When I supply a character variable to the png function rather than an explicit string, I get the same error in htmlize. Analyzing the error message, I realized that it was not complaining about the filename, but about the geometry of the device it was opening. When I added a width argument to the command:
png(filename,width=480) it worked fine. I'm not sure exactly what is happening and am attempting to fix this at the moment, but if you try adding a width argument (480 is the default width) it may work for you as well. Alternatively you can specify the filename explicitly: png("Storage001.png") and that should work. Jim On Thu, Jun 4, 2015 at 5:52 PM, valerio orfano <ingorf...@hotmail.com> wrote: > Belowe My code: > > treemap.R > ------------------------------------ > library(portfolio) > library(sendmailR) > setwd("C:/Users/Administrator/Desktop") > data_all <- read.csv("prova_data.txt", sep='\t', stringsAsFactors = FALSE) > distinctstorage <- unique(data_all$Storage) > stor_var <- "Storage001" > > filename <- paste(stor_var,".png",sep='') > > png(filename) > print (stor_var) > data = data_all[data_all$Storage == stor_var,] > capacity <- data[data$Id == 'Capacity','size'] > data <- data[data$Id != 'Capacity',] > storage <- data$Storage[1] > disk_used <- sum(data$size) > data$col <- seq(1,nrow(data),1) > col_free <- max(data$col + 1) > space_free <- capacity - disk_used > if (space_free < 1000) > { > col_free <- -17 > } > data = rbind(data,c('Free',storage,free_space,col_free)) > data$col <- as.numeric(data$col) > data$size <- as.numeric(data$size) > map.market(id = data$Id, area = data$size, group = data$Storage, color = > data$col, lab=c(TRUE,TRUE), main="Test Map") > dev.off() > > > > Script.R > ——————————————— > library(prettyR) > setwd("C:/Users/Administrator/Desktop") > htmlize("treemap.R","treemap") > > Belowe the error i get > > htmlize("treemap.R","treemap") > Error in .geometry(width, height, units, res) : > object 'NAStorage001.png' not found > > > Any help is appreciated! > > rgds valerio > > On 04 Jun 2015, at 02:12, Jim Lemon <drjimle...@gmail.com> wrote: > >> Hi valerio, >> Any chance of letting me know how "it didn't work out"? For example >> your code and the resulting error message. >> >> Jim >> >> >> On Wed, Jun 3, 2015 at 10:32 PM, valerio orfano <ingorf...@hotmail.com> >> wrote: >>> Hi Jim and thanx. Unfortunately it didn’t work out!! >>> >>> any other help? >>> >>> rgds valerio >>> On 03 Jun 2015, at 02:29, Jim Lemon <drjimle...@gmail.com> wrote: >>> >>>> 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 <ingorf...@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@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. >>> > ______________________________________________ R-help@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.