小编scu*_*fer的帖子

是否有 R 函数可以调整条形图轴的比例?

我有一个名为 crashes_deaths_injuries_TA_pop 的数据框,如下所示:

TA_姓名 人口
血块 34466
布勒 444444
克鲁斯 34455

我试图用条形图显示数据,但是,x 轴的比例混乱,我不知道如何。我知道这一定很容易,但我是编码新手,所以我很挣扎。

这是我的条形图代码:

ggplot(crashes_deaths_injuries_TA_pop, aes(x = reorder(TA_name, Population), y = Population, fill = Population)) +
  geom_col(alpha = 0.7) +
  scale_fill_distiller(palette = "Reds", direction = 1) +
  coord_flip() +
  labs(x = "", y = "Population", fill = "Population",
       title = "Populations of South Island TA's | 2018",
       caption = "Data: Census 2018, StatsNZ") +
  theme_minimal() +
  theme(legend.position = "none") 
Run Code Online (Sandbox Code Playgroud)

我还想知道如何在每个 TA_name 的每个栏末尾添加人口作为数字

条形图

r bar-chart ggplot2

2
推荐指数
1
解决办法
234
查看次数

标签 统计

bar-chart ×1

ggplot2 ×1

r ×1