[R] Plot-region not complete

David Winsemius dwinsemius at comcast.net
Sat Nov 28 19:58:51 CET 2009


On Nov 28, 2009, at 12:09 PM, Markus Häge wrote:

> Hello there,
>
> after I solved many problems in the last days with R I wanted to
> complete my plot. I used
> ylab=expression(paste("log(",mu,"/",cm^2,"/VS)"))
> to have greek symbols and to change cm^2 to cm². Also cm^-3 I have in
> another plot, but it cuts my ^2 to _ in the y-axis.
>
> here is the code and I attach the plot:
>
> jpeg(file="Tabh2.jpg",quality=100)
> plot(Temp3,bew2log,xlab="log(T/K)",ylab=expression(paste("log(",mu,"/ 
> cm^2/VS)")),xlim=range(c(Temp3)),cex.axis=1.5,cex.lab=1.5)
> abline(reg=fitbew,lty=1)
> lines(Temp3,bewt2,lty=2)
> legend(1.932,2.9,c("Experiment"),pch=1,bty="n")
> legend(1.9,2.88,c("Regression","Theorie"),bty="n",lty=c(1,2))
> dev.off()
>

It would seem obvious that we cannot reproduce what you are seeing  
without "Temp3" or bew2log" or "fitbew", but it also seems as though  
some of your questions are concerning how to mix text and Greek  
letters in the ylab argument, for which the data is not really needed.

?plotmath
?bquote   # I'm too clueless get either expression or as.expression to  
"work".
# bquote also offers the possibility of substitution of values  
through .()

jpeg(file="Tabh2.jpg",quality=100);
plot(1,1, xlab="log(T/K)", ylab=bquote(log(mu/cm^2/VS)), xlim=c(-4,4),  
cex.axis=1, cex.lab=1)
legend(1.932,2.9,c("Experiment"),pch=1,bty="n")
legend(1.9,2.88,c("Regression","Theorie"),bty="n",lty=c(1,2));
dev.off()

> Somewhere I have to add a bigger plot-region... and I don't know the
> code.

You need bigger margins so the superscripted exponents do not get cut  
off on the left side, not bigger plot regions, that is if you want  
cex.lab > 1. To do that you need to reset the margins for the device  
_after_ the device is opened.

jpeg(file="Tabh2.jpg",quality=100);   par(mar=c(5, 5, 4, 2) + 0.1)
plot(1,1,xlab="log(T/K)",ylab=bquote(log(mu/cm^2/VS)), xlim=c(-4,4),  
cex.axis=1.5, cex.lab=1.5)
legend(1.932,2.9,c("Experiment"),pch=1,bty="n")
legend(1.9,2.88,c("Regression","Theorie"),bty="n",lty=c(1,2));
dev.off()

I am on a Mac, so it is possible that you will not get the  
satisfactory result I am viewing at the moment.

-- 
David.

 > sessionInfo()
R version 2.10.0 Patched (2009-10-29 r50258)
x86_64-apple-darwin9.8.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets   
methods   base

other attached packages:
  [1] sp_0.9-44          ks_1.6.8           mvtnorm_0.9-8       
KernSmooth_2.23-3
  [5] lme4_0.999375-32   Matrix_0.999375-31 plm_1.2-1           
sandwich_2.2-1
  [9] zoo_1.5-8          MASS_7.3-3         Formula_0.2-0       
kinship_1.1.0-23
[13] lattice_0.17-26    nlme_3.1-96        survival_2.35-7

loaded via a namespace (and not attached):
[1] grid_2.10.0  tools_2.10.0




>
> thanks
>
> Markus
> ______________________________________________
> 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
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list