title: Dual "y" axis in ggplot2 plot
body: <p>I know this topic has arisen some time in different threads of this page, but I am afraid that following the instructions of all of them I have not managed to fix it. I have been trying to solve this problem for a week that seems quite trivial and I can not find the way.</p>
  
  <p>I do not know if it's about differences in the graphics or that there is something I do wrong. The case is as follows. I have two graphics using the <code>ggplot2</code> package:</p>
  
  <pre><code>library(ggplot2)
  data&lt;-data.frame(Age=0,var2=0,var1=0,inf=0,sup=0,ppv=0)
  data[1,]&lt;-c(1,1,0.857,0.793,0.904,0.03)
  data[2,]&lt;-c(1,2,0.771   ,0.74,0.799,0.056)
  data[3,]&lt;-c(1,3,0.763   ,0.717,0.804,0.06) 
  data[4,]&lt;-c(1,4,0.724   ,0.653,0.785,0.09)
  data[5,]&lt;-c(2,1,0.906,0.866,0.934,0.055)
  data[6,]&lt;-c(2,2,0.785   ,0.754,0.813,0.067)
  data[7,]&lt;-c(2,3,0.660,0.593,0.722,0.089)
  data[8,]&lt;-c(2,4,0.544,0.425,0.658,0.123)
  
  pd &lt;- position_dodge(0.2) # 
  names(data)&lt;-c("Age","var2","var1","inf","sup","ppv")
  data$Age&lt;-as.character(data$Age)
  data$var2&lt;-as.character(data$var2)
  p&lt;- ggplot(data, aes(x=var2, y=var1, colour=Age)) + 
    geom_errorbar(aes(ymin=inf, ymax=sup), width=.1 , position=pd) +
    geom_line(position=pd,aes(group=Age),linetype=c("dashed")) +
    geom_point(position=pd,size=3)   +
    theme_light()+
    ylim(0,1) +
    scale_color_manual(values=c("1"="grey55","2"="grey15"))+guides(fill=guide_legend(nrow=2,byrow=TRUE) 
    )
  s&lt;- ggplot(data, aes(x=var2, y=ppv, colour=Age)) + 
    geom_line(position=pd,aes(group=Age),linetype=c("dashed")) +
    geom_point(position=pd,size=3)   +
    theme_light()+
    ylim(0,0.2) +      scale_color_manual(values=c("1"="grey55","2"="grey15"))+guides(fill=guide_legend(nrow=2,byrow=TRUE) 
    )
  </code></pre>
  
  <p>They look like this:</p>
  
  <p><strong>Image of p</strong>
  <a href="https://i.stack.imgur.com/2Ii9y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2Ii9y.png" alt="enter image description here"></a></p>
  
  <p><strong>Image of s</strong>
  <a href="https://i.stack.imgur.com/ETVN2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ETVN2.png" alt="enter image description here"></a></p>
  
  <p>I was wondering if someone would know the way to put them together in a single graph, with the two scales that they currently have, for example, the y axis of the graph p at the left side and the y axis of the graph s at the right side since I can not directly draw both data in a graph due to the radical difference in the scales .</p>
  
  <p>Thank you very much for your time,</p>
  
  <p>Best regards,</p>