I am trying to draw Density ridgeline plots. So I went to see Introduction to ggridges. Ridgelines can be drawn at the moment, but there was a problem when painting Density ridgeline plots. But I get this error: Error in data.frame(..., check.names = FALSE). How do I modify my code?
I first tried geom_density_ridges()
with my own data, but showed the following error:
Error in data.frame(..., check.names = FALSE).
So I tried R's iris dataset and still showed that same error.
library(ggplot2)
library(ggridges)
data2=iris
ggplot(iris, aes(x = Sepal.Length, y = Species)) + geom_density_ridges()
Picking joint bandwidth of 0.181
Don't know how to automatically pick scale for object of type quosure/formula. Defaulting to continuous. Error in data.frame(..., check.names = FALSE) : 参数值意味着不同的行数: 2, 1536
Here's an attempt on my own data set:
data1<-read.table(file="greatwalldatatest.txt",header=T,sep="\t",fileEncoding = "UTF-16")
ggplot(data1, aes(data1$longitude, data1$dynasty, height = data1$elevation, group = data1$dynasty)) +
+ geom_density_ridges(stat = "identity", scale = 1)
ggplot(data1, aes(x = data1$elevation, y = data1$dynasty)) + geom_density_ridges()
Picking joint bandwidth of 70.6 Don't know how to automatically pick scale for object of type quosure/formula. Defaulting to continuous. Error in data.frame(..., check.names = FALSE) : 参数值意味着不同的行数: 2, 1536
Initially I wanted to use ‘geom_density_ridges()’ to depict the elevation changes of the data points for the three periods, but for now I seem to need help! thank you very much!