Christopher W. Ryan
2024-Sep-13 01:10 UTC
[R] how to specify point symbols in the key on a lattice dotplot
I am making a dotplot with lattice, as follows: dd %>% dotplot( segment ~ transit_time, groups = impact, data = ., as.table = TRUE, pch = 16:17, cex = 1.8, scales = list(cex = 1.4), auto.key = TRUE) impact is a factor with two levels. They key shows 2 open circles, one of each color of my two plotting symbols, one for each group. I would like the symbols in the key to match the plotting characters in the graph: 16 (filled circle) for one group and 17 (filled triangle) for the second group. How would I do that? I have not had any success with supplying arguments to auto.key, simpleKey, or key. Guess I'm not understanding the syntax. Thanks. --Chris Ryan -- Agency Statistical Consulting, LLC Helping those in public service get the most from their data. www.agencystatistical.com Public GnuPG email encryption key at https://keys.openpgp.org 9E53101D261BEC070CFF1A0DC8BC50E715A672A0
CALUM POLWART
2024-Sep-13 07:29 UTC
[R] how to specify point symbols in the key on a lattice dotplot
Add: key = list(points=16:17) Into the dotplot section possibly without the autokey On Fri, 13 Sep 2024, 08:19 Christopher W. Ryan, <cwr at agencystatistical.com> wrote:> I am making a dotplot with lattice, as follows: > > dd %>% dotplot( segment ~ transit_time, groups = impact, data = ., > as.table = TRUE, > pch = 16:17, > cex = 1.8, > scales = list(cex = 1.4), > auto.key = TRUE) > > impact is a factor with two levels. > > They key shows 2 open circles, one of each color of my two > plotting symbols, one for each group. I would like the > symbols in the key to match the plotting characters in the graph: 16 > (filled circle) for one group and 17 (filled triangle) for the second > group. How would I do that? I have not had any success with supplying > arguments to auto.key, simpleKey, or key. Guess I'm not understanding > the syntax. > > Thanks. > > --Chris Ryan > > -- > Agency Statistical Consulting, LLC > Helping those in public service get the most from their data. > www.agencystatistical.com > > Public GnuPG email encryption key at > https://keys.openpgp.org > 9E53101D261BEC070CFF1A0DC8BC50E715A672A0 > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Deepayan Sarkar
2024-Sep-13 10:19 UTC
[R] how to specify point symbols in the key on a lattice dotplot
On Fri, 13 Sept 2024 at 12:49, Christopher W. Ryan <cwr at agencystatistical.com> wrote:> > I am making a dotplot with lattice, as follows: > > dd %>% dotplot( segment ~ transit_time, groups = impact, data = ., > as.table = TRUE, > pch = 16:17, > cex = 1.8, > scales = list(cex = 1.4), > auto.key = TRUE) > > impact is a factor with two levels. > > They key shows 2 open circles, one of each color of my two > plotting symbols, one for each group. I would like the > symbols in the key to match the plotting characters in the graph: 16 > (filled circle) for one group and 17 (filled triangle) for the second > group. How would I do that? I have not had any success with supplying > arguments to auto.key, simpleKey, or key. Guess I'm not understanding > the syntax.Specifying key = list(...) will work, but the shortcut is to add par.settings = simpleTheme(pch = 16:17, cex = 1.8) That way, you don't need to specify the parameters anywhere else. -Deepayan> Thanks. > > --Chris Ryan > > -- > Agency Statistical Consulting, LLC > Helping those in public service get the most from their data. > www.agencystatistical.com > > Public GnuPG email encryption key at > https://keys.openpgp.org > 9E53101D261BEC070CFF1A0DC8BC50E715A672A0 > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Apparently Analagous Threads
- how to specify point symbols in the key on a lattice dotplot
- how to specify point symbols in the key on a lattice dotplot
- when installing packages for R on Linux, is it better to use my distro's package manager, or install.packages()?
- Dotplot edition
- font size in the trellis plot