【发布时间】:2021-12-04 14:01:54
【问题描述】:
我正在尝试编辑我的代码以使所有文本和标签都具有以下颜色信息 RGB:(204、14、68) 十六进制:#CC0E44 HSL:(243、222、109)
这是我当前的代码及其当前输出
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())
感谢您的帮助!
【问题讨论】:
-
将
text = element_text(color = "#CC0E44")作为theme()的参数。 -
我也可以使用'family ='函数来添加times新的罗马字体吗?
-
我不明白为什么不这样做。
-
我该怎么做?到目前为止,我发现的想法有问题。
标签: r ggplot2 data-visualization rgb hsl