助けが必要です。
私は使用してggridges
いますが、以下に例示する問題が発生します。
y 軸の順番、つまり (1, 10, 11, 2) が間違っています。最後の図の y 軸の順序を (1, 2, 3, 10, 20) にしたい 以下のコード:
library(ggplot2)
library(ggridges)
iris1 <- iris
iris2 <- iris
# change levels
levels(iris1$Species) <- c(1,2,10)
levels(iris2$Species) <- c(1, 3, 20)
# offset iris2 so we can see it
iris2$Sepal.Length <- iris2$Sepal.Length + 1
# PLots with correct order of y
ggplot() + geom_density_ridges(data = iris1, aes(x = Sepal.Length, y = Species))
# the addition of layers throws off the order
ggplot() +
geom_density_ridges(data = iris1, aes(x = Sepal.Length, y = Species)) +
geom_density_ridges(data = iris2, aes(x = Sepal.Length, y = Species))