1

I used plot.new to combine two different graphs on R with this code:

par(mar=c(4, 4, 3, 5))
plot(d1, col="grey", yaxt="n", xlab="", ylab = "", ylim(0, 1.5), type = "h", fill ="grey")
axis(4, at=seq(0,1.5, by=0.05), col="grey", col.axis="grey")
mtext("Fn_1", side=4, line=2.5, col="grey")
mtext("Sqrt Insolation", side=1, line=2.5, col="black")
par(new=TRUE)
plot(h, axes=FALSE, type = "l", xlab = "", ylab="")
axis(2, ylim=c(-0.10, 0.1), at=seq(-0.10, 0.1, by=0.05), col="black", col.axis="black")     mtext("Fn_2", side=2, line=2.5, col="black")

This is my result https://i.stack.imgur.com/umCWu.png

I want to have a y axis like ylim = c (-0.10,1.5) and adjust the scale (h curb is way too big with this scale ..) OR two y axes like here, but align on 0 with the same scale. I tried to change the criteria of my axes but they seem to adjust automatically to make sense with the minimum and maximum of my data. I want to have one y axis as ylim = c(-0.10,1.5) and adjust scale (h courb is way too large with this actual scale..)

Can someone help me ?

Thank you very much

dcarlson
  • 10,936
  • 2
  • 15
  • 18
CeliaMag
  • 11
  • 1
  • 1
    This may help answer your question [How can I plot with 2 different y-axes?](https://stackoverflow.com/questions/6142944/how-can-i-plot-with-2-different-y-axes/6143251). If that does not work for you, provide your data by pasting the results of `dput(d1)` and `dput(h)` into your question so we can reproduce what you are trying to do since it relates to your particular data. – dcarlson Jul 28 '21 at 03:22

0 Answers0