【发布时间】:2020-03-09 00:50:27
【问题描述】:
我正在使用ggplot 进行数据可视化项目。我有我的英文原始数据:
world_ecommerce <- data.frame(
year = factor(c(2014, 2015, 2016, 2017, 2018)),
score = c(1336, 1548, 1845, 2304, 2842)
)
我想将其可视化为条形图并以波斯语显示所有数字。我原来的条形图是:
ggplot(
world_ecommerce,
aes(x = year, y = score, label = score),
fill = "#56c7da"
) +
geom_bar(
stat = "identity",
fill = "#56c7da",
position = position_dodge(),
width = 0.5,
size = 0
) +
geom_text(
aes(label = score),
vjust = -1.5,
color = "#555555",
position = position_dodge(width = 0.5),
size = 3.5
) +
scale_y_continuous(
expand = c(0,0),
limits = c(0, 3150),
breaks = c(
500, 1000, 1500, 2000, 2500, 3000
)
) +
xlab("سال") +
ylab("") +
ggtitle("میلیارد دلار") +
labs(
subtitle = "اندازه بازار خرده فروشی آنلاین در دنیا",
caption = "منبع: سایت تحلیلی-پژوهشی Statista"
)
我需要 geom_text 标签和轴号为波斯语(例如,2015 而不是 2015)。
【问题讨论】:
标签: r ggplot2 localization farsi