Skip to content
Prev 172770 / 398506 Next

problems with exporting a chart

Thanks a lot for your suggestion Uwe!

This is something for me to get my head around! 

Best regards
Lena
 -----Original Message-----
From: 	Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de] 
Sent:	Thursday, 5 March 2009 10:54 PM
To:	Elena Wilson
Cc:	r-help at r-project.org
Subject:	Re: [R] problems with exporting a chart
Elena Wilson wrote:
There is also a win.metafile(), by the way.
You probably do not want the legend function that is intended to works 
with base graphics. Instead, use the "key" argument for your lattice 
function histogram() as described in the help page ?xyplot.

Example:


histogram( ~ Delta_R2 | as.factor(Size), type="percent", col="red", 
xlab="Delta OLS - SV R squared", main="R Squared Deviations",
     panel = function(x, ...){
         panel.histogram(x, ...)
          draw.key(list(cex=0.7, text=list(lab=c(paste(c('Mean', 'SD', 
'Median', 'IQR'), round(c(mean(x), sd(x), median(x), IQR(x)), 3), 
sep="=")))),
                   draw = TRUE,
                   vp = viewport(x = unit(0.25, "npc"), y = unit(0.9, 
"npc")))
     })



Next, you probably do not want to copy but just re-print into an 
appropriate device.


Uwe Ligges