[R] Plotmath, sweave and lattice graphics interaction problem

Duncan Mackay mackay at northnet.com.au
Sat Aug 29 01:04:17 CEST 2009


Hi Gavin

I am running on windows and have no problem

R version 2.9.2 (2009-08-24)
i386-pc-mingw32

locale:
LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252

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

other attached packages:
[1] Hmisc_3.6-1       R.oo_1.4.8        R.methodsS3_1.0.3 
foreign_0.8-37    chron_2.3-30      MASS_7.2-48       lattice_0.17-25

loaded via a namespace (and not attached):
[1] cluster_1.12.0

Can forward you my sweave file et al if required

Regards

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email home: mackay at northnet.com.au

At 03:10 29/08/2009, you wrote:
>Dear List,
>
>I have hit this problem with using a plotmath expression in an axis
>label on a lattice plot I'm including in a Sweave document. The actual
>document is far too long and boring (unless you are interested in the
>hydrochemistry of upland lakes) to include here, but the following
>minimal example reproduces the problem; basically, the PDF produced by
>Sweave has missing characters in the plotmath label whilst the eps file
>doesn't.
>
>Here is the minimal Rnw document:
>
>\documentclass[a4paper,12pt]{article}
>\usepackage{graphicx,xspace}
>\usepackage[utf8]{inputenc}
>\usepackage[left=1.5cm,top=2cm,bottom=2cm,right=1.5cm]{geometry}
>
>\usepackage{/home/gavin/R/2.9-patched/build/share/texmf/Sweave}
>\setkeys{Gin}{width=1\textwidth}
>
>\begin{document}
>\title{FOO}
>\author{Gavin Simpson}
>
>\maketitle
>
><<fig=true>>=
>require(lattice)
>dat <- data.frame(A = runif(10), B = runif(10))
>print(xyplot(A ~ B, data = dat,
>              ylab = expression(H^"+" ~ (mu*eq ~ L^"-1"))))
>@
>
>\end{document}
>
>Note the ylab expression:
>
>ylab = expression(H^"+" ~ (mu*eq ~ L^"-1"))
>
>this produces a ylab like H+ (mueq L-1) when run interactively and on
>the eps file, but the pdf file is missing the parentheses and the mu
>(micro) symbol.
>
>R session info:
>
> > sessionInfo()
>R version 2.9.1 Patched (2009-08-07 r49104)
>x86_64-unknown-linux-gnu
>
>locale:
>LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C
>
>attached base packages:
>[1] tools     stats     graphics  grDevices utils     datasets
>methods
>[8] base
>
>other attached packages:
>[1] lattice_0.17-25
>
>loaded via a namespace (and not attached):
>[1] grid_2.9.1
>
>So I'm running this in a UTF-8 locale. Is it this that is causing the
>problem? Any suggestions as to how to proceed?
>
>Thanks in advance,
>
>G
>
>--
>%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>  Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
>  ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
>  Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
>  Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
>  UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
>%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>
>______________________________________________
>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.




More information about the R-help mailing list