[R] Bug in recording (Windows graphical device)

Morten Sickel Morten.Sickel at nrpa.no
Wed Feb 5 16:03:02 CET 2003


I was making a lot of similiar plots, so I made a script for making each of
them and a driver program that repeatly called the script with the right
parameters. The plot is made by:

<code>
barplot(Releases[[i]],col='gray',names.arg=as.character(Releases$Year),
ylim=c(0,max),ylab=unit)
box()
grid(col='black',nx=NA,ny=NULL)
rect(-0.5,max*0.98,-0.2+strwidth(Nuc)*1.2,max*0.92,col='white',border='white
')
text(strwidth(Nuc)/2-0.2,max*0.95,Nuc,cex=1.2)
</code>

My first attempt was to use the recording function in the device and just
call it using 

<code>
for (i in c(1,2,5,7,8,9,10,12,14,15,16,18,19,20,23,24,25)){
source('Barplot-prog.R')}
}
</code>

Which messed up the grid drawed on the plot, the lines were extended all the
way through the margins. Saving each plot to a file, otoh, works, it also
makes the recorded plots correct. After this has occured the first time, I
have to close and reopen the graphics device to make it work correctly
again. 

I can send data and complete scripts if someone needs them to investigate
the problem.

Morten




More information about the R-help mailing list