I have dataset from 1996/05/01 to 1990/12/31. Between 1996/05/01 and 1973/01/27 the measuring units are in inches and from 1973/01/28 to 1990/12/31 they are in meters. I would like to plot a a graph with dual Y-axis. I have been using the code below but my two graphs are overlaying on top on each other:
This is the code I used:
par(mar = c(5,4,4,4) + 0.3)
plot(df, col="black", pch=".",
xlim = as.Date(c("1966-05-01", "1973-01-27")))
par(new = TRUE)
plot(df, col= "red", pch= ".",
axes = FALSE, xlab = "", ylab = "",
xlim = as.Date(c("1973-01-28", "1990-12-31")))
axis(side = 4, at = pretty(range(df)))
mtext(df, side = 4, line = 3)