Carlos Ortega
2006-Mar-01 12:10 UTC
[R] Problems to get a ctree plot in a file via jpeg/png
Hello All, I am using library "party" and I have found a curious/strange behaviour when trying to save the output of a ctree in a file via jpeg/png command. If you use: ################ library(party) airq <- subset(airquality, !is.na(Ozone)) airct <- ctree(Ozone ~ ., data = airq) plot(airct, terminal_panel = node_boxplot, drop_terminal = FALSE) ############### you get a perfect and nice graph, but when you try the equivalent but trying to put the output in a file: ################# library(party) airq <- subset(airquality, !is.na(Ozone)) airct <- ctree(Ozone ~ ., data = airq) jpeg(filename = "Rplot%03d.jpg", width = 1400, height = 800, pointsize = 12, quality = 75, bg = "white", res = NA) plot(airct, terminal_panel = node_boxplot, drop_terminal = FALSE) dev.off() ################ you will see that the boxplots at the terminal nodes do not appear... On the other hand, when you try a similar approach with ################## plot(airct, terminal_panel = node_boxplot, drop_terminal = FALSE) savePlot(file=paste(directorio,"PartyTree",sep=""),type="jpeg", devicedev.cur()) dev.off() ################# you get everything perfectly fine, although with a lower resolution. I am using the latest version available of your library (0.8-1) in a Windows box. Do you know if this is the expected behaviour or there is something abnormal ? ########### platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 2.1 year 2005 month 12 day 20 svn rev 36812 language R ########### Package *party* version 0.8-1 I checked this problem directly with the package creators/maintainers and they recommended to post it here. They have also provided very kindly a workaround while it is finally corrected. Thanks, Carlos Ortega. [[alternative HTML version deleted]]