[R] Problem using mtext to write onto a jpeg

David Winsemius dwinsemius at comcast.net
Tue Jul 3 17:00:15 CEST 2012


On Jul 3, 2012, at 4:01 AM, georgeshirreff wrote:

> 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)

Try instead something like:

quartz(file="file_name.jpeg", type="jpeg", width=7,height=7)

And follow-ups should go the R-SIG-Mac mailing list. And please update  
your installation of R.

-- 
David.
>
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list