[R] Lattice xyplot: Fill Legend Points
Richard M. Heiberger
rmh at temple.edu
Thu Oct 17 20:15:07 CEST 2013
I always get lost in simpleKey. The approach of directly modifying
the trellis object usually works.
> tmp <- xyplot(pct.quant ~ sampdate, data = ffg.st, groups = func_feed_grp, type =
+ 'p', pch = 19, key = simpleKey(text = levels(ffg.st$func_feed_grp), space =
+ 'right', points = T, lines = F),par.settings = list(superpose.points =
+ list(col = rainbow(7)), superpose.lines = list(col = rainbow(7))), main =
+ 'Functional Feeding Groups (Individuals)', xlab = 'Year', ylab = 'Proportion
+ of Individuals')
> tmp
> str(tmp)
> tmp$legend$right$args$key$points$pch
[1] 1 1 1 1 1 1 1
> tmp$legend$right$args$key$points$pch[] <- 19
> tmp$legend$right$args$key$points$pch
[1] 19 19 19 19 19 19 19
> tmp
>
Rich
On Thu, Oct 17, 2013 at 12:57 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> On Thu, 17 Oct 2013, Richard M. Heiberger wrote:
>
>> That should have worked.
>
>
> That's what I thought when I first tried it.
>
>
>> I think something else is interfering. Did you redefine either T or F?
>
>
> Not intentionally.
>
>
>> Please send the output from dput(head(ffg.st)) so we can experiment in
>> your setting.
>
>
> structure(list(sampdate = structure(c(13326, 13326, 13326, 13326, 13326,
> 13326), class = "Date"), func_feed_grp = structure(c(1L, 2L, 3L, 4L, 6L,
> 7L), .Label = c("Filterer", "Gatherer", "Grazer", "Omnivore", "Parasite",
> "Predator", "Shredder"), class = "factor"),
> quant = c(812L, 1880L, 624L, 11L, 948L, 1540L), pct.quant = c(0.14,
> 0.323, 0.107, 0.002, 0.163, 0.265), num.taxa = c(11L, 28L,
> 4L, 1L, 12L, 3L), pct.num.taxa = c(0.186, 0.475, 0.068, 0.017,
> 0.203, 0.051)), .Names = c("sampdate", "func_feed_grp", "quant",
> "pct.quant", "num.taxa", "pct.num.taxa"), row.names = 102:107, class =
> "data.frame")
>
>
> Rich
>
> --
> Richard B. Shepard, Ph.D. | Have knowledge, will travel.
> Applied Ecosystem Services, Inc. |
> <http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
>
> ______________________________________________
> 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