可视化R中ggplot2中堆叠条形图的顶部

问题描述 投票:0回答:2

我在R的ggplot2中制作了一个堆叠的barplot:

ggplot(Count_dataframe_melt, aes(x = as.factor(variable), y = value, fill = fill)) + 
 geom_bar(stat = "identity",position="fill")+ scale_y_continuous(name = "Y-axis",labels = scales::percent)

““ >>

我只想像这样可视化堆叠条形图的顶部:

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9OZEx1dC5wbmcifQ==” alt =“我想要的可视化”>

我到处都看过,不知道该怎么做。有人知道吗?

[我在R中的ggplot2中制作了一个堆叠的条形图:ggplot(Count_dataframe_melt,aes(x = as.factor(variable),y = value,fill = fill))+ geom_bar(stat =“ identity”,position =“ fill” )+ scale_y_continuous(name = ...

r ggplot2 geom-bar
2个回答
0
投票

您可以使用coord_cartesian在所需区域上“放大”。


0
投票

由于您要显示的区域少于总区域的20%,因此您可以翻转条形图,以便仅显示颜色区域。然后,y轴从0%到25%,您可以使用图形标题来描述剩余数据在灰色类别中。

© www.soinside.com 2019 - 2024. All rights reserved.