Dr L. Y Hin
2006-Dec-16 01:22 UTC
[R] Seeking advice on lattice package in R2.4.0 concerning stripplot
Dear all, I am using the R 2.4.0 environment on Windows XP SP2 machine and trying to use the lattice package version 0.14-9 which you have kindly written to share with the R community. I have a question concerning the stripplot which I'd be very grateful if you can kindly advise me on: I used the dataset called trydata to plot a graph using stripplot (dataset attached), and the scripts used to procude the plot is as follows: trydata<-dget("trydata") stripplot(Position~Count|y*Grouping,jitter=T,group=subtype, data=trydata,xlab="Count rate (%)", pch=c(0,3,6,5), key=list(text=list(c("GS in front", "GS at the back", "MS in front","MS at the back")), points = Rows(trellis.par.get("superpose.symbol"),1:4), columns=2)) When I plotted the graph and viewed it on R, the legend and the datapoint shapes are correct. However, when I export it into .pdf form using the pulldown menu in R, the legend for "GS in front" is incorrect. Instead if being a prism, it became a circle. How can I get around this? I've attached the figure thus generated in pdf form for your kind consideration. Specifically, how can I modify the specifications in the command to produce the correct pch type in the legend as in the chart itself? Thank you very much in advance for your kind advice. Best Lin -------------- next part -------------- A non-text attachment was scrubbed... Name: trydatafigure.pdf Type: application/pdf Size: 13614 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/20061216/c233eaae/attachment.pdf
Prof Brian D Ripley
2006-Dec-16 06:24 UTC
[R] Seeking advice on lattice package in R2.4.0 concerning stripplot
The problem looks to be that you are specifying the types of symbols in two ways:> pch=c(0,3,6,5),> points = Rows(trellis.par.get("superpose.symbol"),1:4),The simplest thing to do is to run your code directly on the pdf() device, but you could experiment with other ways of setting the key. (We don't have the data, so cannot test these ideas.) On Sat, 16 Dec 2006, Dr L. Y Hin wrote:> Dear all, > > I am using the R 2.4.0 environment on Windows XP SP2 machine and trying to > use the lattice package version 0.14-9 which you have kindly written to share > with the R community. > > I have a question concerning the stripplot which I'd be very > grateful if you can kindly advise me on: > > I used the dataset called trydata to plot a graph using > stripplot (dataset attached), and the scripts used to procude the plot is as > follows: > > trydata<-dget("trydata") > stripplot(Position~Count|y*Grouping,jitter=T,group=subtype, > data=trydata,xlab="Count rate (%)", > pch=c(0,3,6,5), > key=list(text=list(c("GS in front", "GS at the back", > "MS in front","MS at the back")), > points = Rows(trellis.par.get("superpose.symbol"),1:4), > columns=2)) > > When I plotted the graph and viewed it on > R, the legend and the datapoint shapes are > correct. However, when I export it into .pdf > form using the pulldown menu in R, the legend for "GS in front" is incorrect. > Instead if being a prism, it became > a circle. How can I get around this? > I've attached the figure thus generated in pdf form > for your kind consideration. > > Specifically, how can I modify the specifications in the > command to produce the correct pch type in the legend as in the chart itself? > > Thank you very much in advance for your kind advice. > > Best > Lin >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595