R 如何添加yaxis

R 如何添加yaxis,r,ggplot2,ggridges,R,Ggplot2,Ggridges,所以我一直在尝试在我的直方图上加上Y轴。现在我的Y刻度是离散的,但如果我把它改成连续的,它就不会绘图。我希望代码有一个y轴,列出海龟的数量 请让我知道我能做什么,谢谢 这是我的代码: library(ggplot2) library(ggridges) ggplot(Merge, aes(x = SCL, y = Type, group = Type, fill = Type)) + geom_density_ridges(stat = "binline", bins =

所以我一直在尝试在我的直方图上加上Y轴。现在我的Y刻度是离散的,但如果我把它改成连续的,它就不会绘图。我希望代码有一个y轴,列出海龟的数量

请让我知道我能做什么,谢谢

这是我的代码:

library(ggplot2)
library(ggridges)
ggplot(Merge, aes(x = SCL, y = Type, group = Type, fill = Type)) +
  geom_density_ridges(stat = "binline", bins = 20, scale = 0.95) +
  scale_y_discrete(name ="Type of Turtles", expand = c(-.0, 0.999)) +
  scale_x_continuous(expand = c(0, 10), name="Total Length (mm)") +
  coord_cartesian(clip = "off") +
  theme(panel.grid.major = element_line(colour="grey"), legend.position='none',
               panel.grid.major.x = element_blank(), axis.text.x = 
   element_text(face="bold", size=17, family= "sans", colour = "black"), 
               axis.text.y = element_text(face="bold", size=17, family= "sans", colour = "black"), 
               text = element_text(face = "bold", size=17, family= "sans", 
    colour="black"), 
               panel.grid.minor.x = element_blank(), panel.border = 
     element_rect(fill=NA, colour = "black", size=1.25), 
               panel.background = element_rect(fill='white', colour='black'))

Merge Hello here,欢迎来到stack overflow。您能否将
dput(Merge)
的输出或虚拟数据添加到您的问题中?如果没有数据进行测试,很难弄清楚这里发生了什么。好吧!!我添加了一些数据!如果有帮助请告诉我,谢谢!我不认为
geom\u density\u ridges()
支持连续比例,而离散比例不能有次轴()。您是否考虑过使用
geom\u柱状图(bins=20)+facet\u网格(Type~)
?我同意这似乎不受支持。可能对你有帮助。谢谢!成功了!!