I'm trying to use the vcd package to produce mosaic plots for my class notes, written in Sweave and using the LaTeX's beamer document class. For projecting the notes in class, I use a dark background with light foreground colors. It's easy enough to change the defaults for R's standard graphics to match my color scheme (using the fg, col.axis, col.lab, col.main, and col.sub parameter settings), but I can't figure out how to do this with grid/strucplot/vcd.>From my experiments, I think that I might eventually figure out how tochange the colors of all the text in the mosaic plots to what I want using arguments like 'gp_args = list(gp_labels = gpar(col = "yellow")' and 'gp_varnames = gpar(col = "yellow")' (although I still haven't figured out how to changed the color of the text on the legends), but this is obviously not what I need. I have been reading all the documentation I can find, but I still haven't figured this out, so an answer accompanied by a reference to some line or the other in some piece of documentation would be greatly appreciated.
You might want to check out package {tikzDevice} and it's documentation. In essence you turn your R plots to tikz-pgf so they can be naturally incorporated into a beamer presentation. Colors, bg, fonts etc. can now be controlled in your main latex doc. I find it much more convenient, and nicer when the plot annotations make use of the same latex font rather than e.g. plotmath. Note, for grid graphics you'll need to use print(yourplot) to the device. Cheers On Fri, Apr 6, 2012 at 8:43 AM, Brett Presnell <presnell at stat.ufl.edu> wrote:> > I'm trying to use the vcd package to produce mosaic plots for my class > notes, written in Sweave and using the LaTeX's beamer document class. > For projecting the notes in class, I use a dark background with light > foreground colors. ?It's easy enough to change the defaults for R's > standard graphics to match my color scheme (using the fg, col.axis, > col.lab, col.main, and col.sub parameter settings), but I can't figure > out how to do this with grid/strucplot/vcd. > > >From my experiments, I think that I might eventually figure out how to > change the colors of all the text in the mosaic plots to what I want > using arguments like 'gp_args = list(gp_labels = gpar(col = "yellow")' > and 'gp_varnames = gpar(col = "yellow")' (although I still haven't > figured out how to changed the color of the text on the legends), but > this is obviously not what I need. ?I have been reading all the > documentation I can find, but I still haven't figured this out, so an > answer accompanied by a reference to some line or the other in some > piece of documentation would be greatly appreciated. > > ______________________________________________ > 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.
Hi On 7/04/2012 2:43 a.m., Brett Presnell wrote:> > I'm trying to use the vcd package to produce mosaic plots for my class > notes, written in Sweave and using the LaTeX's beamer document class. > For projecting the notes in class, I use a dark background with light > foreground colors. It's easy enough to change the defaults for R's > standard graphics to match my color scheme (using the fg, col.axis, > col.lab, col.main, and col.sub parameter settings), but I can't figure > out how to do this with grid/strucplot/vcd. > >> From my experiments, I think that I might eventually figure out how to > change the colors of all the text in the mosaic plots to what I want > using arguments like 'gp_args = list(gp_labels = gpar(col = "yellow")' > and 'gp_varnames = gpar(col = "yellow")' (although I still haven't > figured out how to changed the color of the text on the legends), but > this is obviously not what I need. I have been reading all the > documentation I can find, but I still haven't figured this out, so an > answer accompanied by a reference to some line or the other in some > piece of documentation would be greatly appreciated.You could push a 'grid' viewport with the desired defaults and then hopefully 'vcd' will pick those up as its defaults. The following example promises at least partial (if ugly) success ... library(vcd) pushViewport(viewport(gp=gpar(col="yellow"))) mosaic(Titanic, newpage=FALSE) You can similarly set up font defaults. See "Non-standard fonts in PostScript and PDF graphics" in http://cran.r-project.org/doc/Rnews/Rnews_2006-2.pdf for an example, plus also possibly http://www.stat.auckland.ac.nz/~paul/R/CM/CMR.html. Paul> ______________________________________________ > 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.-- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/