Is there any way to change the font of a residuals-based legend in the strucplot
framework, e.g. mosaic or assoc plots? I've created labels in mosaic plots
and extended association plots with serif font by specifying the font in the
labeling and labeling_args parameters. This makes the text in the plot is in
serif font. I have tried to make the residuals-based legend in serif font too by
calling par(family="serif") at the start of the code and the end, but
this does not make the legend text serif. I have also tried calling
family="serif" and fontfamily="serif" in the legend,
legend_resbased, and legend_args() arguments. While I am able to specific
fontsize and other graphical parameters in these, family or fontfamily do not
seem to work in these particular arguments.
I'm using Rstudio (Version 0.97.551) through R (Version 2.14.0) on a Mac OS
X 10.6. I'm a relatively inexperienced R user. The only reason I'm using
R 2.14.0 is because I needed to make an extended association plot for a paper
that has been accepted for publication, but was unable to call an assoc() plot
in the 3.0.1 version (it has been confirmed that this is due to a bug in the
current vcd package that will be fixed in the next update). When I re-installed
the R version I originally created the extended association plot on in 2012, it
worked ok, so I'm sticking with that until I can try the updated vcd package
in 3.0.1.
My example data is a 6x3 array with row and column names:
names<-c("A", "B", "C", "D",
"E")
y<-c(340, 37, 110, 17, 71)
z<-c(720, 14, 6, 141, 120)
x<-data.frame(names, y, z, row.names=TRUE); x
attach(x)
library(vcd)
The code I am using is:
op<-par(family="serif")
my.largs<-list(gp_labels=gpar(fontsize=12, fontfamily="serif"),
gp_varnames=gpar(fontsize=12, fontfamily="serif",
fontface="italic"))
names(dimnames(x))<-c("Name1", "Name2")
mosaic(t(x), gp=shading_Friendly, compress=FALSE, gp_text=gpar(fontsize=12,
fontfamily="serif"), labeling=labeling_values, labeling_args=my.largs)
par(op)
Is anyone able to help at all?
Kind regards, Gabrielle
[[alternative HTML version deleted]]