[R] Problem using mtext to write onto a jpeg

georgeshirreff georgeshirreff at googlemail.com
Tue Jul 3 10:01:41 CEST 2012


Dear all,

I am trying to write figures directly to a file using the jpeg() function. 

this_ylab=expression(paste("P",sep="")~lambda)
this_xlab=expression(rho)

jpeg("file_name.jpeg",width=100,height=100,units="mm",res=300)

plot(input_values,output_values,pch=16,cex=cex_pt,xlab="",frame.plot=T,ann=F,axes=F)
axis(side=2)
axis(side=1,labels=T,xlab="")
mtext(this_xlab,side=1,line=4,cex=2)
mtext(this_ylab,side=2,line=3,cex=2)

dev.off()


However, I get the following error message:

Error in mtext(this_xlab, side = 1, line = 4, cex = 2) : 
  Metric information not available for this device

I could put the argument specifying the x-label in the "plot" function but
then I don't control where it goes. When I have used the tiff() function
instead I don't have this problem. 

I am using R 2.11.1 on Mac OS X 10.7.3


Thanks,
George


--
View this message in context: http://r.789695.n4.nabble.com/Problem-using-mtext-to-write-onto-a-jpeg-tp4635258.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list