2

I'd like to set the font for geom_text to Roboto condensed.

I tried to do it wih hrbrbr themes, but it doesn't appear to be in roboto condensed.

I know this thread has an answer, but it requires changing the font system wide.

Can I apply roboto condensed to a ggplot chart for only the geom_text labels?

1 Answer 1

2

I don't think the answer you have linked does change the font system-wide. It just gives you the ability to access a font. I'll demonstrate here using a handwriting font to make this very obvious:

windowsFonts(Script = windowsFont("Edwardian Script ITC"))

library(ggplot2)

ggplot(mtcars, aes(disp, mpg)) + 
  geom_text(aes(label = rownames(mtcars)), family = "Script") 

You can see the axis labels and markers are not affected.

Created on 2020-05-15 by the reprex package (v0.3.0)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.