[R] xyplot auto.key issue
Deepayan Sarkar
deepayan.sarkar at gmail.com
Sun Jul 31 16:47:29 CEST 2005
On 7/31/05, Mike Lawrence <Mike.Lawrence at dal.ca> wrote:
> Hi Deepayan,
>
> Thanks for the reply, but when I enter the " type = "b" " code into the
> auto.key
> (see below) command I get the following message:
>
> Error in valid.pch(x$pch) : zero-length 'pch'
Yes, this was a bug. I believe it's fixed in the latest release
(0.12-1) and if not, it will be fixed in the soon to be released
0.12-2. In either case, you need to specify
pch=c(1, 2, 3, 4, 5)
in auto.key, since you don't want the default pch anyway.
> Any suggestions?
>
> xyplot(
> #basic settings
> bias ~ sample_size | measure,
> data = bias,
> groups = exp_tau,
> type = "b",
> pch = c(1,2,3,4,5),
> xlab = "Sample Size",
> ylab = "Bias (ms)",
> #make strips transparent
> strip = function(bg, ...) strip.default(bg = 'transparent', ...),
> # tweak scales
> scales=list(
> x=list(
> at = c(20, 40, 60),
> tck = c(1,0),
> alternating = F
> ),
> y=list(
> at = c(-50, -25, 0, 25, 50),
> tck = c(1,0),
> alternating = F
> )
> ),
> # tell key to match symbols to those used in the plot
> par.settings = list(
> superpose.symbol = list(
> cex = .8,
> pch = c(1,2,3,4,5)
> )
> ),
> # key settings
> auto.key = list (
> type = "b",
> lines = T,
> border = T,
> cex.title = 1.2,
> title = "Expected Tau",
> text = c("30 ms", "80 ms", "130 ms", "180 ms", "230 ms"),
> space = "right"
> )
> )
>
>
> Quoting Deepayan Sarkar <deepayan.sarkar at gmail.com>:
>
> > On 7/30/05, Mike Lawrence <Mike.Lawrence at dal.ca> wrote:
> >> Quick correction:
> >>
> >> The lines "lines = T," & "type = "b"" in the "par.settings" section
> should
> >> not
> >> be there. They are remnants of my previous (failed) attempts at solving
> the
> >> problem. Below is the correct code:
> >>
> >> xyplot(
> >> #basic settings
> >> bias ~ sample_size | measure,
> >> data = bias,
> >> groups = exp_tau,
> >> type = "b",
> >> pch = c(1,2,3,4,5),
> >> #make strips transparent
> >> strip = function(bg, ...) strip.default(bg = 'transparent', ...),
> >> # tweak scales
> >> scales=list(
> >> x=list(
> >> at = c(20, 40, 60),
> >> tck = c(1,0),
> >> alternating = F
> >> ),
> >> y=list(
> >> at = c(-50, -25, 0, 25, 50),
> >> tck = c(1,0),
> >> alternating = F
> >> )
> >> ),
> >> # tell key to match symbols to those used in the plot
> >> par.settings = list(
> >> superpose.symbol = list(
> >> cex = .8,
> >> pch = c(1,2,3,4,5)
> >> )
> >> ),
> >> # key settings
> >> auto.key = list (
> >> lines = T,
> >> size = 7,
> >
> > You seem to be missing a 'type="b"' somewhere here. The type="b"
> > argument to xyplot is actually handled by the panel function. The key
> > has type="l" by default (see under 'key' in ?xyplot) and has to be
> > changed explicitly.
> >
> >> border = T,
> >> cex.title = 1.2,
> >> title = "Expected Tau",
> >> text = c("30 ms", "80 ms", "130 ms", "180 ms", "230 ms"),
> >> space = "right",
> >> )
> >> )
> >>
> >>
> >>
> >> Quoting Mike Lawrence <Mike.Lawrence at dal.ca>:
> >>
> >> > Hi all,
> >> >
> >> > I'm having a problem with the auto.key function in xyplot. I hate to
> >> > bother the
> >> > list like this and I'm positive I must be missing something very
> simple,
> >> yet
> >> > I've spent the last day searching for a solution to no avail.
> >> >
> >> > Essentially, I want a key that contains entries in which the plot
> points
> >> are
> >> > superimposed on a line of the same color as the points, like this:
> >> o--o--o
> >> > Now, given the presence of the default "divide" command, I assume this
> is
> >> > simple; indeed, I get the impression that this representation is
> >> > supposed to be
> >> > produced automatically. Yet I can't seem to get it to work!
> >> >
> >> > Now, I've incorporated various other tweaks to my xyplot function, so
> I'm
> >> > wondering if these tweaks are somehow hindering my efforts. The
> function
> >> is
> >> > pasted below; I am making a 3x3 plot, each panel contains 5 lines and
> it
> >> is
> >> > these lines that I want represented in the key. See the comments for
> >> > descriptions of the modifications.
> >> >
> >> > Any help would be greatly appreciated.
> >> >
> >> > Cheers,
> >> >
> >> > Mike
> >> >
> >> >
> >> > xyplot(
> >> > #basic settings
> >> > bias ~ sample_size | measure,
> >> > data = bias,
> >> > groups = exp_tau,
> >> > type = "b",
> >> > pch = c(1,2,3,4,5),
> >> > #make strips transparent
> >> > strip = function(bg, ...) strip.default(bg = 'transparent', ...),
> >> > # tweak scales
> >> > scales=list(
> >> > x=list(
> >> > at = c(20, 40, 60),
> >> > tck = c(1,0),
> >> > alternating = F
> >> > ),
> >> > y=list(
> >> > at = c(-50, -25, 0, 25, 50),
> >> > tck = c(1,0),
> >> > alternating = F
> >> > )
> >> > ),
> >> > # tell key to match symbols to those used in the plot
> >> > par.settings = list(
> >> > superpose.symbol = list(
> >> > cex = .8,
> >> > pch = c(1,2,3,4,5)
> >> > ),
> >> > lines = T,
> >> > type = "b"
> >> > ),
> >> > # key settings
> >> > auto.key = list (
> >> > lines = T,
> >> > size = 7,
> >> > border = T,
> >> > cex.title = 1.2,
> >> > title = "Expected Tau",
> >> > text = c("30 ms", "80 ms", "130 ms", "180 ms", "230 ms"),
> >> > space = "right",
> >> > )
> >> > )
> >> >
> >> >
> >> >
> >> > --
> >> >
> >> > Mike Lawrence, BA(Hons)
> >> > Research Assistant to Dr. Gail Eskes
> >> > Dalhousie University & QEII Health Sciences Centre (Psychiatry)
> >> >
> >> > Mike.Lawrence at Dal.Ca
> >> >
> >> > "The road to Wisdom? Well, it's plain and simple to express:
> >> > Err and err and err again, but less and less and less."
> >> > - Piet Hein
> >> >
> >> > ______________________________________________
> >> > R-help at stat.math.ethz.ch mailing list
> >> > https://stat.ethz.ch/mailman/listinfo/r-help
> >> > PLEASE do read the posting guide!
> >> http://www.R-project.org/posting-guide.html
> >> >
> >>
> >>
> >>
> >> --
> >>
> >> Mike Lawrence, BA(Hons)
> >> Research Assistant to Dr. Gail Eskes
> >> Dalhousie University & QEII Health Sciences Centre (Psychiatry)
> >>
> >> Mike.Lawrence at Dal.Ca
> >>
> >> "The road to Wisdom? Well, it's plain and simple to express:
> >> Err and err and err again, but less and less and less."
> >> - Piet Hein
> >>
> >> ______________________________________________
> >> R-help at stat.math.ethz.ch mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide!
> >> http://www.R-project.org/posting-guide.html
> >>
> >
>
>
>
> --
>
> Mike Lawrence, BA(Hons)
> Research Assistant to Dr. Gail Eskes
> Dalhousie University & QEII Health Sciences Centre (Psychiatry)
>
> Mike.Lawrence at Dal.Ca
>
> "The road to Wisdom? Well, it's plain and simple to express:
> Err and err and err again, but less and less and less."
> - Piet Hein
>
>
More information about the R-help
mailing list