Re: [R] Question on big JPG plots in function warpping format

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sat 11 Feb 2006 - 03:12:58 EST

Most likely this is FAQ 7.22.

althogh how we are supposed to know what plotHeatTrellis does is beyond me.

On Fri, 10 Feb 2006, alexfang@stat.rutgers.edu wrote:

>
>
> Hello:
>
> I have problems generating big JPG plots in functions. the following code runs
> fine in the script:
>
> #### runs fine in script, generate 40k "test1.jpg" in the given directory
> plotPlatesAlong <- c(1:5)
> plotDirPath <- paste(dataPath, "OutputPlots\\", sep="")
> filename <- paste(plotDirPath,"test1.jpg", sep="")
> jpeg(file=filename)
> plotHeatTrellis(dataPath, plotVariable = "Raw", plotPlatesAlong)
> # here plotHeatTrellis() generates a complicate plot, but it works
> dev.off()
> #### End of script
>
>
> but if I wrap it in a function, it doesn't work.
>
> ######## put it in a function and run test(dataPath)
> ######## it will make "test1.jpg" in the given directory, but only 6k in size
> ######## and if I open the file, it's blank
> test <- function(dataPath) {
> plotPlatesAlong <- c(1:5)
> plotDirPath <- paste(dataPath, "OutputPlots\\", sep="")
> filename <- paste(plotDirPath,"test1.jpg", sep="")
> jpeg(file=filename) #
> plotHeatTrellis(dataPath, plotVariable = "Raw", plotPlatesAlong)
> dev.off()
> }
> ######### enf of the program
>
>
> I've tested the simple plot function, like
>
> ########## works fine both with in script and function wrapping format
> testplot <- function(plotDirPath) {
> filename1 <- paste(plotDirPath, "test1.jpg",sep="")
> jpeg(file=filename1)
> plot(1:10, rnorm(10, 0), type="b")
> dev.off()
> }
> ###########
>
> Any one have any clues, why this happen and how could I fix my code and my mine
> working also in the function wrapping format? Thanks.
>
>
> best, Alex
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sat Feb 11 03:20:51 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:27 EST