[英]ggplot2 colour appears in grey and not with colour
so i have this data eight_gen_scatter: 所以我有这个数据four_gen_scatter:
pro = c("CONCOCT", "MetaBAT", "MaxBin", "MyCC")
MEGAHIT = c(3, 3, 3, 3)
RayMeta = c(3, 2, 1, 4)
SPAdes = c(3, 3, 2, 3)
Velvet = c(3, 3, 0, 2)
and i have the following code: 我有以下代码:
ggplot(eight_gen_scatter_melted,aes(x=variable, y=value, color=Programas)) +
geom_bar(stat="identity",position="dodge") +
scale_fill_discrete(name="variable", breaks=c(1, 2, 3, 4),
labels=c("CONCOCT", "MaxBin", "MetaBAT", "MyCC")) +
scale_y_continuous(limits = c(0, 8))
But somehow the bars are with colour grey and just the border is with different colors, how do i fill up the bars with the colours. 但是不知何故,条形为灰色,只是边框具有不同的颜色,我该如何用颜色填充条形。
I'll be very grateful if you could give some help. 如果您能提供帮助,我将不胜感激。
THis code below works perfectly for me. 下面的代码非常适合我。 I don't understand why did you add "scale_fill_discrete()"?
我不明白为什么要添加“ scale_fill_discrete()”? Do you want to change the order of items in the legend?
您是否要更改图例中的项目顺序?
The legend will be added automatically since you set "fill= Programas". 自设置“ fill = Programas”以来,图例将自动添加。 So you don't need extra code.
因此,您不需要额外的代码。
ggplot(df, aes(x = variable, y = value, fill= Programas)) + geom_bar(stat = "identity", position = "dodge")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.