如何根据我的geom_violin中的y轴值给出颜色?
如何根据我的geom_violin中的y轴值给出颜色? 我想表明,Y值较大的因素具有更强烈的蓝色,并且Y值较小的因素的红色较小。我想保留那个调色板。请有人可以帮我吗?
我在r:
ggplot(df4, aes(x =orden, y = size, fill = orden)) +
geom_violin(trim = FALSE) +
scale_fill_brewer(palette="RdBu")+
geom_boxplot(width = 0.07) +
scale_x_discrete(labels = c("Insectos palo","Hormigas", "Escarabajos",
"Áfidos", "Moscas", "Mariposas", "Polillas",
"Saltamontes")) +
labs(x=c(""),y="Tamaño del genoma (Mb)")+
#scale_y_continuous(trans = "log2")+#, breaks = c(20, 40, 80))
theme_classic()
非常感谢
How to give colors based on the Y axis values in my geom_violin?
I would like to show that factors with larger y values have a more intense blue and factors with smaller y values have a less intense red. I would like to keep that color palette. Please can someone help me?
I have de following script in R:
ggplot(df4, aes(x =orden, y = size, fill = orden)) +
geom_violin(trim = FALSE) +
scale_fill_brewer(palette="RdBu")+
geom_boxplot(width = 0.07) +
scale_x_discrete(labels = c("Insectos palo","Hormigas", "Escarabajos",
"Áfidos", "Moscas", "Mariposas", "Polillas",
"Saltamontes")) +
labs(x=c(""),y="Tamaño del genoma (Mb)")+
#scale_y_continuous(trans = "log2")+#, breaks = c(20, 40, 80))
theme_classic()
Many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试一下。我将
alpha
放在geom_violin
中,以改变该地理的强度。在2022-07-07创建的 reprex软件包(v2.0.1)
Try this. I've put
alpha
in thegeom_violin
to vary the intensity of that geom.Created on 2022-07-07 by the reprex package (v2.0.1)