我的 y 轴值与 ggplot 中不匹配

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

我有一个如下所示的数据集: 我想绘制仅短案例与短加长案例之间的共同值和唯一值。我使用 ggplot 绘制堆栈条形图以获得更好的可视化效果。但在我的图中,y 轴值与我的数据框中的值不匹配。

dput(datamine)
structure(list(specie = c("short_only", "short_only", "shortpluslong", 
"shortpluslong"), condition = c("common", "unique", "common", 
"unique"), value = c(9577, 556, 9577, 2342)), class = "data.frame", row.names = c(NA, 
-4L))

ggplot(datamine, aes(fill=condition, y=value, x=specie)) + 
     geom_bar(position="fill", stat="identity")

我的情节是这样的: enter image description here

r dataframe ggplot2 plot bar-chart
1个回答
0
投票

你的问题是

geom_bar
中的位置参数。

ggplot(datamine, aes(fill=condition, y=value, x=specie)) + 
geom_bar(stat="identity")
© www.soinside.com 2019 - 2024. All rights reserved.