Theme text size vs. annotation text size.

A journal to which I am submitting a paper requires that all plot text, including annotation text, should be the same size. I recognize that the units for text size in the theme definitions (points as in font size) are different from the units for text size in annotations (mms). According to

r - ggplot2 - The unit of size - Stack Overflow

dividing the theme text size (in points) by .pt should create an annotation size (in mm) = to the theme text size. However, as shown in the plot below, this is apparently not quite accurate. The size of the text in the p-value annotation, adjusted by dividing the theme size by .pt, is still noticably larger than the text of the axis labels and tick labels.

Is there a newer value for the adjustment between theme text size and annotation text size? Or should I just fudge the ajusting factor until they are (approximately) the same size? Thanks for any advice on this issue.
Larry Hunsicker
Size difference.pdf (4.7 KB)

Although I typically prefer doing things right in ggplot, this might be a situation where editing the pdf after it was created (e.g. in Inkscape or Illustrator) might be the easiest solution.

You tried this?

"The font size is controlled by the size aesthetic. Unlike most tools, ggplot2 specifies the size in millimeters (mm), rather than the usual points (pts). The reason for this choice is that it makes it the units for font sizes consistent with how other sizes are specified in ggplot2. (There are 72.27 pts in a inch, so to convert from points to mm, just multiply by 72.27 / 25.4)."

No. I have zero experience with editing pdfs, and I have access to neither Inkscape nor Illustrator. But I suspect that the AV folks at my Univeristy do have them.

I am aware of the units for both the ggplot themes (points) and annotations/geom_text (mms). 72.27/25.4 = 2.845276, which is the value of the built in R constant .pt. So dividing the text font size in points by .pt is supposed to give the corresponding font size for annotations/geom_text. This is the conversion that is used in the program that produced the plot in my original message. The conversion is obviously not quite correct, as the size (converted as above) of the annotation is visibly larger than the supposedly equivalent theme size. That's what I was asking about. I was hoping that someone from the ggplot team would pick up on this discrepancy and comment -- hopefully giving a corrected adjustment based on actual programmatic ratios. I am a bit uneasy simply adjusting .pt until the fonts seem to be the same size as judged by my very fallible vision.
In any case, thanks for reading my question and taking the time to reply.

A more careful look at the size and font face of the axis labels and the annotation text in the above example plot shows that the letters are accurately scaled by division by .pt. But the figures (at least the zeros) are both too large, and are also apparently from a different font family. I think now that the size correction (annotation size/.pt = theme text size) is accurate, but that the annotation font is changed.

I think that I found the answer. I eventually located specifications of the defaults for theme_bw (and other themes) at:

There I found what I assume is the answer to my conundrum. The theme defaults include several lines along the following line:
axis.text = element_text(size = rel(0.8), ...
which I assume is the basis for the size discrepancy -- i.e, that the size of the axis ticks and titles are in fact only 80% of the basis text size. So if the journal editors complain that, "all plot text, including annotation text, should be the same size." I at least now know how to correct the discrepancies.

But I sort of like the aesthetics of what the ggplot folks have set up as the defaults.
Larry Hunsicker

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.