ggplot2 point and axis title (and text) sizes: how compatibilize then?

Dear all,

My doubt is related to the size of geometries and texts (in axes of a chart). I'm trying to export a chart with the size of the font must be approximately to 12 points, so I've declared size = 12/.pt in element_text(). To exemplify, I wrote the code:

library(ggplot2)
chart = ggplot(diamonds)+
  geom_point(aes(x, price), size = 1, shape = "circle open")+
  theme(axis.title = element_text(size = 12/.pt),
        axis.text = element_text(size = 12/.pt))

chart

Since the ggplot2 works with milimeters in its units, if I understod, declaring geom_point(size = 1) and theme(axis.title and axis.text = element_text(size = 12/.pt)), the size of the points must be inferior than text, right? Why this not occurs?

My apologies by incipient english.

My best regards!

1 Like

If I read the help of element_text() correctly, the size of the text is expected in points and not mm (an exception). So your geom_point is making circles 2mm diameter (1 for the size and 1 for the stroke), while your element_text makes the font 12/.pt/.pt = 1.48 mm big.

1 Like

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