I am trying to edit my code to make all the text and labels with the following color information RGB: (204, 14, 68) Hex: #CC0E44 HSL: (243, 222, 109)
Here is my current code and its current output
ggplot(Alldata, aes(Date)) geom_tile(aes(alpha = Recession, y = 1),
fill = "grey", height = Inf)
scale_alpha_continuous(range = c(0, 1),
breaks = c(0, 1), labels = c("0" = "Expansion", "1" = "Recession"))
geom_line(aes(y = INFEX), col = "blue", size = .8)
ylab('Infation Expectations (%)')
labs(x = NULL, alpha = "Economic Cylcle", color = "Economic Variable",
title = "Rising Inflation Expectations in 2021",
caption = 'Cleveland Fed Model of 10-year Inflation Expectations',
subtitle = '"Directionality Matters"')
theme(plot.background = element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major= element_blank())
Thanks for the help!
CodePudding user response:
add the following line to theme function:
theme(
text = element_text(color = '#CC0E44')
)
CodePudding user response:
To add another font family
install.packages("showtext", dependencies = TRUE)
library(showtext)
font_add("Times New Roman", regular = "times.ttf",bold = 'timesbd.ttf',
italic = 'timesi.ttf', bolditalic = 'timesbi.ttf')
then in your plot call, inside element_text()
, put family = 'Times New Roman'
. And you can modify the the face by adding the face
argument as well.