r - ggplot2 for R 中的主题 _stata 是否仍然可用?我收到一条错误消息
问题描述
我想theme_stata
用于我的 ggplot。使用以下代码,一切正常,除了主题:
df3 <- data_summary(panel_data,
varname = "invest_amnt",
groupnames = c("trend_id", "path_id")
)
df3$path_id <- as.factor(df3$path_id)
df3$trend_id <- as.factor(df3$trend_id)
head(df3)
df.mean <- df3 %>%
group_by(path_id) %>%
mutate(ymean = mean(invest_amnt))
p <- ggplot(df3, aes(x = path_id, y = invest_amnt, fill = trend_id)) +
geom_bar(stat = "identity", position = position_dodge()) +
geom_errorbar(aes(ymin = invest_amnt-sd, ymax = invest_amnt+sd),
width=.2, position=position_dodge(.9))
p +
scale_fill_brewer(palette = "Paired") +
theme_stata() +
scale_color_stata()
p +
labs(title = "", x = "path)", y = "Invested Amount") +
scale_fill_manual(values = c('#f55b5b','#23036b','#e3d613' )) +
theme_classic() +
geom_errorbar(data = df.mean, aes(x = path_id , ymax = ymean, ymin = ymean),
size=1.5, linetype = "longdash", inherit.aes = F, width = 1)
我收到以下错误消息:
Error in theme_stata() : could not find function "theme_stata"
解决方案
theme_stata()
是ggthemes
package的一部分。该软件包应加载library(ggthemes)
.
推荐阅读
- vb.net - VB.NET 静态变量存储在哪里?
- dns - 在 Windows Server 2019 AD 中创建子 DNS 时,父 dns 是服务器 2008 先决条件检查失败
- php - 显示数据的问题,来自 laravel 视图中的 sqlite?
- c# - 如何在 C# 中获取拉普拉斯算子的方差
- c++ - Project Euler #8:C++ 不正确的答案(对小的熟化输入给出正确的答案)
- csv - 将 CSV 文件转换为 Siddhi 事件
- kubernetes-helm - 如何在 Helm 图表中将字符串化的 json 值作为参数/变量?
- android - 在颤动地图视图中单击导航图标时,在谷歌地图中的两个标记之间显示方向
- c++ - lambda中的noexcept如何在vs2012中工作?
- json - 架构 - 星级从谷歌消失:“评论没有指定名称的评论项目”