[R] plot from source file

Vladimir Eremeev wl2776 at gmail.com
Thu Oct 4 13:37:44 CEST 2007


It's a FAQ #7.22

Wrap your plotting commands with print, that is, 
print(bwplot(  )) 
and 
print(xyplot(  )) 



Armin Goralczyk wrote:
> 
> Dear list
> Maybe someone can help with the following problem:
> I have a source file containing the following code for plotting:
> 
> pdf(file = 'data/mario/boxplot.pdf')
> bwplot(sig100 ~ target | group, data = fish, main = 'Boxplot der
> Signale in 100 Zellen nach Gruppe', xlab = '', ylab = 'Anzahl der
> Signale')
> dev.off()
> 
> pdf(file = 'data/mario/xyplot.pdf')
> xyplot(sig100 ~ target | group, data = fish, main = 'Signale in 100
> Zellen nach Gruppen', xlab = '', ylab = 'Anzahl der Signale',
> 	panel = function(x,y, ...) {
> 		panel.grid(h = -1, v = -1)
> 		panel.xyplot(x,y, jitter.x=TRUE)
> 		panel.lmline(x,y, lty = 2, col = 3)})
> dev.off()
> 
> If I run the file from R with
> source('lib/analysis_mario.R')
> a two pdf-files will be created but they cannot be read.
> 
> When I use
> source('lib/analysis_mario.R', echo=TRUE)
> the files are created correctly.
> 
> Actually I don't want the echo, so what can I do to plot correctly and
> omit the echo in one run.
> 
> I use
> 
> platform       powerpc-apple-darwin8.9.1
> arch           powerpc
> os             darwin8.9.1
> system         powerpc, darwin8.9.1
> status
> major          2
> minor          5.1
> year           2007
> month          06
> day            27
> svn rev        42083
> language       R
> version.string R version 2.5.1 (2007-06-27)
> -- 
> Armin Goralczyk, M.D.
> 

-- 
View this message in context: http://www.nabble.com/plot-from-source-file-tf4566488.html#a13038038
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list