Karl Ove Hufthammer
2013-Feb-08 13:46 UTC
[R] Border width on symbols plotted with the lattice package
Dear list members, I can't figure out how get 'xyplot' or 'dotplot' in the 'lattice' package to respect the 'lwd' value for specifying the border with for *symbols* (for lines it works fine). Example: ----- # Base graphics works fine (gives a 'fat? circle) plot(5, cex=10, pch=21, lwd=10) # But 'xyplot' or 'dotplot' doesn't library(lattice) xyplot(4:5~4:5, groups=4:5, par.settings = simpleTheme(cex=10, pch=21, lwd=5), auto.key=TRUE) ----- For 'xyplot' or 'dotplot' the border stays thin no matter what I set 'lwd' to. However, the symbols shown in the *legend* has the 'lwd' correctly applied. How can I fix this? Or is it simply a bug in the 'lattice' package? Karl Ove Hufthammer Output of 'sessionInfo()': R version 2.15.2 (2012-10-26) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=Norwegian-Nynorsk_Norway.1252 [2] LC_CTYPE=Norwegian-Nynorsk_Norway.1252 [3] LC_MONETARY=Norwegian-Nynorsk_Norway.1252 [4] LC_NUMERIC=C [5] LC_TIME=Norwegian-Nynorsk_Norway.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] lattice_0.20-13 loaded via a namespace (and not attached): [1] grid_2.15.2 tools_2.15.2
Like this ? xyplot(4:5~4:5, groups=4:5, lex = 5 , par.settings = simpleTheme(cex=10, pch=21, lwd=5), auto.key=TRUE) On Fri, Feb 8, 2013 at 6:46 AM, Karl Ove Hufthammer <karl@huftis.org> wrote:> Dear list members, > > I can't figure out how get 'xyplot' or 'dotplot' in the 'lattice' package > to respect the 'lwd' value for specifying the border with for *symbols* > (for lines it works fine). Example: > > ----- > # Base graphics works fine (gives a 'fat’ circle) > plot(5, cex=10, pch=21, lwd=10) > > # But 'xyplot' or 'dotplot' doesn't > library(lattice) > xyplot(4:5~4:5, groups=4:5, par.settings = simpleTheme(cex=10, pch=21, > lwd=5), > auto.key=TRUE) > ----- > > For 'xyplot' or 'dotplot' the border stays thin no matter what I set 'lwd' > to. However, the symbols shown in the *legend* has the 'lwd' correctly > applied. > > How can I fix this? Or is it simply a bug in the 'lattice' package? > > > Karl Ove Hufthammer > > > > Output of 'sessionInfo()': > > R version 2.15.2 (2012-10-26) > Platform: x86_64-w64-mingw32/x64 (64-bit) > > locale: > [1] LC_COLLATE=Norwegian-Nynorsk_**Norway.1252 > [2] LC_CTYPE=Norwegian-Nynorsk_**Norway.1252 > [3] LC_MONETARY=Norwegian-Nynorsk_**Norway.1252 > [4] LC_NUMERIC=C > [5] LC_TIME=Norwegian-Nynorsk_**Norway.1252 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] lattice_0.20-13 > > loaded via a namespace (and not attached): > [1] grid_2.15.2 tools_2.15.2 > > ______________________________**________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> > PLEASE do read the posting guide http://www.R-project.org/** > posting-guide.html <http://www.R-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
David Winsemius
2013-Feb-08 17:04 UTC
[R] Border width on symbols plotted with the lattice package
On Feb 8, 2013, at 5:46 AM, Karl Ove Hufthammer wrote:> Dear list members, > > I can't figure out how get 'xyplot' or 'dotplot' in the 'lattice' package to respect the 'lwd' value for specifying the border with for *symbols* (for lines it works fine). Example: > > ----- > # Base graphics works fine (gives a 'fat? circle) > plot(5, cex=10, pch=21, lwd=10) > > # But 'xyplot' or 'dotplot' doesn't > library(lattice) > xyplot(4:5~4:5, groups=4:5, par.settings = simpleTheme(cex=10, pch=21, lwd=5), > auto.key=TRUE) > ----- > > For 'xyplot' or 'dotplot' the border stays thin no matter what I set 'lwd' to. However, the symbols shown in the *legend* has the 'lwd' correctly applied. > > How can I fix this? Or is it simply a bug in the 'lattice' package?The grid.points function can accept a lwd argument: xyplot(4:5~4:5, groups=4:5, panel=function(x,y,groups,...){ panel.xyplot(x,y,...,col='white') grid.points(x,y, gp=gpar(cex=10, lwd=7) ) }, auto.key=TRUE) This probably means there is a less hackish way of setting the lwd.points, but I don't find it in my sequesntial following through the lattice help pages. -- David Winsemius Alameda, CA, USA
Karl Ove Hufthammer
2013-Feb-10 17:45 UTC
[R] Border width on symbols plotted with the lattice package
ilai skreiv:> Like this ? > xyplot(4:5~4:5, groups=4:5, lex = 5 , > par.settings = simpleTheme(cex=10, pch=21, lwd=5), > auto.key=TRUE)Thanks, both David and ilai. The ?lex? solution seems to work very well. -- Karl Ove Hufthammer E-mail: karl at huftis.org Jabber: huftis at jabber.no
Reasonably Related Threads
- R on Windows crashes when using certain characters in strings in data frames (PR#14125)
- Kerning issues with CairoPDF
- match function causing bad performance when using table function on factors with multibyte characters on Windows
- R on Windows crashes when using certain characters in strings (PR#14137)
- Long for Loop- calling C from R - Parallel Computing