[R] losing line of mtext when saving to png format

John Kane jrkrideau at yahoo.ca
Sun Jun 13 21:09:00 CEST 2010


I have a simple graph (oode below) which looks fine on the screen but when
I save it in png format the title (actually the last mtext line) is cut off.

I am pretty sure that I am doing something very stupid but 
other than playing around with the png height and width commands which don't seem to help I have no idea of what to look for.

Any suggestions or cures would be appreciated.

Thanks
#===============================================================#

mydata  <- data.frame(kel = c(13,253,263,273,283,292,303,313,323,333,573,853),
              cent=  c( -280, -40, -30, -20, -10, 1, 10, 20, 30, 40, 280, 560))        
(intervals <- diff(mydata[,1]))

opar <- par(mar= (c(5, 4, 6, 2)))

# png("C:/Rjunk/brendengraph.png", width=600, height=500)

plot(1:12,mydata$kel, main=" ", xlab=" ",
       ylab=" ",type="l", col="red", xaxt="n", yaxt="n",cex=.75)
       
axis(1, at=1:12,labels=as.character(mydata$kel), cex.axis=.75)

axis(3, at=1:12, labels=as.character(mydata$cent), cex.axis=.75)

mtext(side = 1, line=2, text="Degrees Kelvin",cex=.75 )
mtext(side = 3, line=2, text="Degrees Centegrade",cex=.75 )
mtext(side=3, line=4, text="Room Temperature", font=2, cex=.85)
# dev.off()
par(opar)
#=================================================================



More information about the R-help mailing list