0

There are different data sets as bottom.

1-1.Data Set(cidf_min.csv)
name number value samples conf lower upper level
apple 1 0.056008 100 0.95 0.05458 0.059141 2
apple 2 0.048256 100 0.95 0.046363 0.059142 2
apple 3 0.042819 100 0.95 0.040164 0.059143 2
apple 4 0.038663 100 0.95 0.035155 0.059144 2
apple 5 0.035325 100 0.95 0.030146 0.059145 2
1-2.Data Set(newdf_min.csv)
name number value samples conf lower upper level max
apple 2 0.01854 100 0.95 -0.06963 0.045235 2 2
  '''code'''
  cidf<-read.csv("D:/cidf_min.csv")
  newdf<-read.csv("D:/newdf_min.csv")
  p_min<-ggplot(cidf, aes(x=number, y=value, group=name))+geom_line(aes(color=level))+geom_ribbon(aes(ymin=lower, ymax=upper, fill=level, group=name), alpha=0.3)+geom_text(data=newdf, aes(label=name, color=level), hjust=-0.2, vjust=0.5, size=3, show.legend=F)+coord_cartesian(xlim=c(0,max(cidf$number)*1.2))+xlab(~"Con (\u00D7"~C[max]*")")+ylab(~"score ("*mu*"C/"*mu*"F)")+theme_bw()
2-1.Data Set(cidf_max.csv)
name number value samples conf lower upper level
apple 1 0.068832 100 0.95 0.061945 0.069416 2
apple 2 0.065256 100 0.95 0.053687 0.065841 2
apple 3 0.060492 100 0.95 0.046201 0.06155 2
apple 4 0.05585 100 0.95 0.039848 0.058739 2
apple 5 0.047585 100 0.95 0.033555 0.056066 2
2-2.Data Set(newdf_max.csv)
name number value samples conf lower upper level max
apple 2 0.024221 100 0.95 -0.04546 0.076362 2 2
  '''code'''
  cidf<-read.csv("D:/cidf_max.csv")
  newdf<-read.csv("D:/newdf_max.csv")
  p_max<-ggplot(cidf, aes(x=number, y=value, group=name))+geom_line(aes(color=level))+geom_ribbon(aes(ymin=lower, ymax=upper, fill=level, group=name), alpha=0.3)+geom_text(data=newdf, aes(label=name, color=level), hjust=-0.2, vjust=0.5, size=3, show.legend=F)+coord_cartesian(xlim=c(0,max(cidf$number)*1.2))+xlab(~"Con (\u00D7"~C[max]*")")+ylab(~"score ("*mu*"C/"*mu*"F)")+theme_bw()
3-1.Data Set(cidf_mean.csv)
name number value samples conf lower upper level
apple 1 0.069673 100 0.95 0.069673 0.069673 2
apple 2 0.06133 100 0.95 0.057955 0.062792 2
apple 3 0.060497 100 0.95 0.046201 0.06155 2
apple 4 0.054623 100 0.95 0.044241 0.058739 2
apple 5 0.039852 100 0.95 0.031906 0.043719 2
3-2.Data Set(newdf_mean.csv)
name number value samples conf lower upper level max
apple 2 0.014323 100 0.95 -0.06793 0.045717 2 2
  '''code'''
  cidf<-read.csv("D:/cidf_mean.csv")
  newdf<-read.csv("D:/newdf_mean.csv")
  p_mean<-ggplot(cidf, aes(x=number, y=value, group=name))+geom_line(aes(color=level))+geom_ribbon(aes(ymin=lower, ymax=upper, fill=level, group=name), alpha=0.3)+geom_text(data=newdf, aes(label=name, color=level), hjust=-0.2, vjust=0.5, size=3, show.legend=F)+coord_cartesian(xlim=c(0,max(cidf$number)*1.2))+xlab(~"Con (\u00D7"~C[max]*")")+ylab(~"score ("*mu*"C/"*mu*"F)")+theme_bw()



  

I already drew 3 plots using code of ggplot, geom_line and geom_ribbon etc.

  1. I want to merge plots of p_min, p_max and p_mean.

  2. p_min, p_max and p_mean must locate in y axis.

  3. x axis is number(1,2,3,4,5).

Let me know how to draw plots of multiple y axis using complex variables in a layout.

Plutos
  • 51
  • 1
  • 8
  • please provide a reproducible example, it is very hard to help you if we cant reproduce you code ( and so far there is no easy way to extract your data tables) see here: https://stackoverflow.com/help/minimal-reproducible-example – yuliaUU May 06 '21 at 18:31
  • @yuliaUU connected you to show the picture of result example as link. You can click the blue character above. – Plutos May 07 '21 at 06:09
  • The problem is that to help you I have to run your code so I can write you a solution. Which I can't do since "D:/cidf_min.csv" does not exists on my computer. – yuliaUU May 07 '21 at 06:32
  • @yuliaUU I already uploaded the data set in "##1-1, 1-2, 2-1, 2-2, 3-1, 3-2" above. Can I provide you my original data file? – Plutos May 07 '21 at 06:48
  • Yes, you showed what your datasets looks like, but they are not reproducible as I can't just copy paste it into r . Instead, to make it easier for others to reproduce your resulys run dput(cidf) and copy paste the output here. Do it for each dataset you use. Or another way is you can upload your data on some website like github and share a link to them (if you are allowed to share them) – yuliaUU May 07 '21 at 07:00
  • got them! thanks for the link! – yuliaUU May 07 '21 at 07:15
  • @yuliaUU My original file include different parameter unlike the parameter of this site. – Plutos May 07 '21 at 07:18
  • @yuliaUU It is perfect result. thank you very much. Can I delete result image that you made. – Plutos May 07 '21 at 08:05
  • Did you mean that you want me to remove the picture from my answer? – yuliaUU May 07 '21 at 08:17
  • Also, if you are satisfied with my answer, can you mark it as an answer? You just need click on the checkmark beside the answer to toggle it from greyed out to fill in. – yuliaUU May 07 '21 at 08:19
  • @yuliaUU Yes. Please, allow me to remove your result picture.ㅠㅠ – Plutos May 07 '21 at 08:21
  • I removed it as you requested:) – yuliaUU May 07 '21 at 08:23
  • @ already voted regarding your answer.^^ – Plutos May 07 '21 at 08:23
  • @yuliaUU Thank you for agreeing my suggest and helping my problem. – Plutos May 07 '21 at 08:26
  • No worries at all:) thanks for the fast responses! – yuliaUU May 07 '21 at 08:27

1 Answers1

0

What I did I first renamed each dataset to cidf1,cidf2, and cidf3 so that they won't mix. and the same for newdf. I added a column type that basically has info of what type of graph it is. I was not sure whether you know the tidyvesre, so I used basic R to add a column using $ operator

#Set 1
cidf1 <- read.csv("cidf_min.csv")
cidf1$type ="P_min"
newdf1<-read.csv("newdf_min.csv")
newdf1$type ="P_min"
 
#Set 2
cidf2<-read.csv("cidf_max.csv")
cidf2$type ="P_max"
newdf2<-read.csv("newdf_max.csv")
newdf2$type ="P_max"

#Set 3
cidf3<-read.csv("cidf_mean.csv")
cidf3$type ="P_mean"
newdf3<-read.csv("newdf_mean.csv")
newdf3$type ="P_mean"
  

then I combined them together:

cidf = rbind(cidf1,cidf2,cidf3)
newdf =rbind(newdf1,newdf2,newdf3)

And plotted them, setting color=type to color each line according to the dataset. I removed other things that you had in your ggplot as they were not related to your question asked.

ggplot(cidf, aes(x=X, y=value))+geom_line(aes(color=type)) +
  geom_ribbon(aes(ymin=lower, ymax=upper, fill=type), alpha=0.3) +
  xlab(~"Con (\u00D7"~C[max]*")")+ylab(~"score ("*mu*"C/"*mu*"F)")+theme_bw()

So it is very close to what you are looking for. Let me know if I misinterpret what you want to do and I will update my code

Plutos
  • 51
  • 1
  • 8
yuliaUU
  • 1,581
  • 2
  • 12
  • 33