why theme_bw changes font size?

799 views
Skip to first unread message

romunov

unread,
Jan 15, 2013, 11:32:09 AM1/15/13
to ggplot2
I just noticed that theme_bw() changes font size to `rel(0.8)` (see source). What's the reasoning behind a (non specialized) theme changing font size? For example, I would understand if a theme were to emulate a specific graphic from a journal that demands a certain font type, but I would not expect a black & white theme to touch the font size.

This is somewhat frustrating when one doesn't realize that the order of calling functions matters. For example, calling `theme(text = element_text(size = 15))` before theme_bw() has no effect, hot blood is spilled and I get flak for how R can't handle basic graphs. :)

Cheers,
Roman


--
In God we trust, all others bring data.

Ista Zahn

unread,
Jan 15, 2013, 12:22:06 PM1/15/13
to romunov, ggplot2
Hi Roman,

On Tue, Jan 15, 2013 at 11:32 AM, romunov <rom...@gmail.com> wrote:
> I just noticed that theme_bw() changes font size to `rel(0.8)` (see source).

Are you referring to

function (base_size = 12, base_family = "")
{
<snip>
theme(axis.text = element_text(size = rel(0.8)), axis.ticks =
element_line(colour = "black"),
<snip>
}

? If so, the default theme_gray does this as well, so it's not really
changing the default, but maintaining it.

> What's the reasoning behind a (non specialized) theme changing font size?
> For example, I would understand if a theme were to emulate a specific
> graphic from a journal that demands a certain font type, but I would not
> expect a black & white theme to touch the font size.

Well, it has to have a value. And it is set the the same value as in
the default theme.

>
> This is somewhat frustrating when one doesn't realize that the order of
> calling functions matters. For example, calling `theme(text =
> element_text(size = 15))` before theme_bw() has no effect, hot blood is
> spilled and I get flak for how R can't handle basic graphs. :)

Well, now you know. Since themes can set all kinds of things, you
should always put things intended to override theme settings after
calling the theme.

Best,
Ista

>
> Cheers,
> Roman
>
>
> --
> In God we trust, all others bring data.
>
> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example:
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
Reply all
Reply to author
Forward
0 new messages