如何改变线的颜色或形状在一个格栅密度图?
ggplot(iris, aes(x = Sepal.Length, y = Species)) +
geom_density_ridges2() +
scale_y_discrete(expand = c(0.01, 0)) +
scale_x_continuous(expand = c(0.01, 0)) +
theme_ridges()

发布于 2022-04-12 12:14:25
我不确定您到底想要什么,但是可以通过在您的color函数中使用这样的geom_density_ridges2函数来更改线条的颜色:
library(tidyverse)
library(ggridges)
ggplot(iris, aes(x = Sepal.Length, y = Species)) +
geom_density_ridges2(color = "red") +
scale_y_discrete(expand = c(0.01, 0)) +
scale_x_continuous(expand = c(0.01, 0)) +
theme_ridges()输出:

如您所见,线条的颜色被更改为红色。
https://stackoverflow.com/questions/71837336
复制相似问题