颜色不同的两个密度图叠加

问题描述

到目前为止,我已经按照上面的代码生成一个输出

head(testing) #1000 rows data.frame,limits c(0,2250)

    cwdf cwd    list2
1  854.000 687 species1

2 1527.000 544 species1

3 1176.667 538 species1

然后我想生成一个密度图并用不同的颜色显示两个密度图,如下所示:

plot.testing = ggplot(testing,aes(x=cwd,y=..density..)) + 
  geom_density(aes(cwd,fill=list2,color= 'cwd'),alpha=.5) + 
  geom_vline(aes(xintercept=mean(cwd)),color="#FDE725FF",linetype="solid",size=1)+
  geom_vline(aes(xintercept=quantile(cwd,0.975)),linetype="dashed",size=1) +
  geom_vline(aes(xintercept=quantile(cwd,0.025)),size=1) +
  
  geom_density(aes(cwdf,color='cwdf'),alpha=.5) +
  geom_vline(aes(xintercept=mean(cwdf)),color="black",size=1)+
  geom_vline(aes(xintercept=quantile(cwdf,size=1) +
  geom_vline(aes(xintercept=quantile(cwdf,size=1) +
  scale_x_continuous(limits = c(0,2000),breaks = breaks,labels = labels) +
  scale_y_continuous(labels = scales::number_format(accuracy = 0.001)) +
  scale_fill_viridis(discrete=T,option="E") +
  scale_colour_viridis(discrete=T,option="E")

到目前为止我得到的是:

the_density_plot_produced

https://documentation.cpanel.net/display/EA4/Tomcat+Proxies

为了清楚起见,我想在此图中表示两种不同的颜色。非常感谢 Viridis Palette。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)