R

Asked • 09/26/19

How can I plot with 2 different y-axes?

I would like superimpose two scatter plots in R so that each set of points has its own (different) y-axis (i.e., in positions 2 and 4 on the figure) but the points appear superimposed on the same figure.Is it possible to do this with `plot`?**Edit** Example code showing the problem # example code for SO question y1 <- rnorm(10, 100, 20) y2 <- rnorm(10, 1, 1) x <- 1:10 # in this plot y2 is plotted on what is clearly an inappropriate scale plot(y1 ~ x, ylim = c(-1, 150)) points(y2 ~ x, pch = 2)

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.