Dear R-help members. I am an 'R-learner' (about 6 hours so far) using the lattice library to create a ranked dotplot and am colour coding the dots by a variable called "Commodity". However when i use autokey to make a legend the size (cex) and symbol (pch) do not match what is on the dotplot. Code is below and image attached library("lattice") Cal_dat <- read.table("Calibration2.dat",header = TRUE,sep = "\t",) dotplot(reorder(Label.yr, Resc_Gt)~ Resc_Gt,groups=Commodity, data=Cal_dat,cex=1.5, pch=19,aspect="xy", auto.key=list(space="right",title="Commodity")) Any assistance appreciated http://r.789695.n4.nabble.com/file/n3756245/Ranked_boxplot_by_commodity.png -- View this message in context: http://r.789695.n4.nabble.com/Auto-key-legend-does-not-match-plot-tp3756245p3756245.html Sent from the R help mailing list archive at Nabble.com.
It is most likely due to your ordering of y values. You need to write key manually to reflect the change. Without providing reproduciable data, you may not get specific help. Weidong Gu On Fri, Aug 19, 2011 at 6:23 PM, markm0705 <markm0705 at gmail.com> wrote:> Dear R-help members. ?I am an 'R-learner' (about 6 hours so far) using the > lattice library to create a ranked dotplot and am colour coding the dots by > a variable called "Commodity". ?However when i use autokey to make a legend > the size (cex) and symbol (pch) do not match what is on the dotplot. > Code is below and image attached > > library("lattice") > Cal_dat <- read.table("Calibration2.dat",header = TRUE,sep = "\t",) > dotplot(reorder(Label.yr, Resc_Gt)~ Resc_Gt,groups=Commodity, > ? ? ? ?data=Cal_dat,cex=1.5, pch=19,aspect="xy", > ? ? ? ?auto.key=list(space="right",title="Commodity")) > > Any assistance appreciated > http://r.789695.n4.nabble.com/file/n3756245/Ranked_boxplot_by_commodity.png > > -- > View this message in context: http://r.789695.n4.nabble.com/Auto-key-legend-does-not-match-plot-tp3756245p3756245.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. >
On Sat, Aug 20, 2011 at 3:53 AM, markm0705 <markm0705 at gmail.com> wrote:> Dear R-help members. ?I am an 'R-learner' (about 6 hours so far) using the > lattice library to create a ranked dotplot and am colour coding the dots by > a variable called "Commodity". ?However when i use autokey to make a legend > the size (cex) and symbol (pch) do not match what is on the dotplot. > Code is below and image attached > > library("lattice") > Cal_dat <- read.table("Calibration2.dat",header = TRUE,sep = "\t",) > dotplot(reorder(Label.yr, Resc_Gt)~ Resc_Gt,groups=Commodity, > ? ? ? ?data=Cal_dat,cex=1.5, pch=19,aspect="xy", > ? ? ? ?auto.key=list(space="right",title="Commodity"))Try dotplot(reorder(Label.yr, Resc_Gt)~ Resc_Gt,groups=Commodity, ? ? ? ?data=Cal_dat, par.settings = simpleTheme(cex=1.5, pch=19), aspect="xy", ? ? ? ?auto.key=list(space="right",title="Commodity")) (see ?simpleTheme for an explanation). -Deepayan