[R] fonts in mosaic
dwinsemius at comcast.net
Sat Apr 2 20:47:57 CEST 2011
On Apr 2, 2011, at 11:16 AM, David Winsemius wrote:
> On Apr 2, 2011, at 6:02 AM, Erich Neuwirth wrote:
>> The problem of changing the default font used fpr the windows
>> device seems to be quite complicated.
>> As I wrote already
>> will make the windows graphics device use Consolas as the
>> defaut font for labels.
>> Therefore, a function call like
>> will use Consolas for labeling.
>> It will, however, not change the default for
>> The mosaic plot will still use the original default font
>> for the device, which in a standard configuration
>> seems to be Arial.
>> will reset the current default font to the original default font,
>> so after this command
>> will use Arial again.
>> The the font family used in graphics from package grid is set by
>> explicitly using gpar paramenter in calls to functions from that
>> gpar has default values, but there seems to be no way
>> of changing the default values of the gpar object.
>> Does anybody on the list know if there is a way of changing the
>> values of gpar objects?
> Make one with your desired values:
> gpCon <- gpar(fontfamily="Consolas", fontsize=8)
> Then pass it to the appropriate argument. I don't have a Windows
> device nor a copy of that font but the following changes several of
> the defaults on a Mac if I use "Times" instead of"Consolas".
> mosaic(Titanic, main="Test of gpar",
> gp_labels=gpCon )
> You _might_ be able to change the defaults with grid:::set.gpar()
> or with grid:::grid.Call("L_setGPar", list(...)) but my efforts did
> not succeed (unless success is measured by undesirable side-effects
> on one's system.) Neither of those functions is "exposed", so it
> would appear that their use is not recommended (or documented). I
> was able to change the internal values returned by get.gpar() but
> passing them on to mosaic() did not succeed.
And then I re-read Prof Ripley's reply and the light dawned:
pdf(); mosaic(Titanic, main="Test of gpar")
My remaining puzzlement is how to apply this strategy to the Mac
quartz(family="serif"); mosaic(Titanic, main="Test of gpar")
# Does not work
# Nor does
quartzFonts("serif"); mosaic(Titanic, main="Test of gpar")
# Nor any other of several permuations of arguments
David Winsemius, MD
West Hartford, CT
More information about the R-help