Since the horizontal axis side=1 is year-month-day, how do I issue an abline command to draw dashed vertical lines, as a background grid, within the graph?s border? Similar to the abline command I call below, in blue, for dashed horizontal lines, as a background grid. Greg y_duration <- c (301.59050, 387.35700, 365.64366, 317.26150, 321.71883, 342.44950, 318.95350, 322.33233, 330.60333, 428.99516, 297.82066, 258.23166, 282.01816) x_yyyymmdd <-as.Date(c ("2018-04-25", "2018-04-26", "2018-04-27", "2018-04-28", "2018-04-29", "2018-04-30", "2018-05-01", "2018-05-02", "2018-05-03", "2018-05-04", "2018-05-05", "2018-05-06", "2018-05-07"), format="%Y-%m-%d") par (mar=c(6,4,4,2)) plot (x_yyyymmdd, y_duration, type="l", xaxt="n", yaxt="n", ylim=range(240,480), xlab="", ylab="", col="blue") abline (h=c(240,270,300,330,360,390,420,450,480,510,540), lty=3, lwd=1.0, col="grey50") axis (side=2, at=240, cex.axis=1.0, label="4:00") axis (side=2, at=300, cex.axis=1.0, label="5:00") axis (side=2, at=360, cex.axis=1.0, label="6:00") axis (side=2, at=420, cex.axis=1.0, label="7:00") axis (side=2, at=480, cex.axis=1.0, label="8:00") axis (side=1, at=x_yyyymmdd, labels=format(x_yyyymmdd, "%Y-%m-%d"), las=2) [[alternative HTML version deleted]]
abline (v=x_yyyymmdd, lty=3, lwd=1.0, col="blue") On Tue, May 8, 2018 at 5:23 PM, Gregory Coats <gregcoats at me.com> wrote:> Since the horizontal axis side=1 is year-month-day, how do I issue an > abline command to draw dashed vertical lines, as a background grid, within > the graph?s border? Similar to the abline command I call below, in blue, > for dashed horizontal lines, as a background grid. > Greg > > y_duration <- c (301.59050, 387.35700, 365.64366, 317.26150, 321.71883, > 342.44950, 318.95350, 322.33233, 330.60333, 428.99516, 297.82066, > 258.23166, 282.01816) > x_yyyymmdd <-as.Date(c ("2018-04-25", "2018-04-26", "2018-04-27", > "2018-04-28", "2018-04-29", "2018-04-30", "2018-05-01", "2018-05-02", > "2018-05-03", "2018-05-04", "2018-05-05", "2018-05-06", "2018-05-07"), > format="%Y-%m-%d") > par (mar=c(6,4,4,2)) > plot (x_yyyymmdd, y_duration, type="l", xaxt="n", yaxt="n", > ylim=range(240,480), xlab="", ylab="", col="blue") > abline (h=c(240,270,300,330,360,390,420,450,480,510,540), lty=3, > lwd=1.0, col="grey50") > axis (side=2, at=240, cex.axis=1.0, label="4:00") > axis (side=2, at=300, cex.axis=1.0, label="5:00") > axis (side=2, at=360, cex.axis=1.0, label="6:00") > axis (side=2, at=420, cex.axis=1.0, label="7:00") > axis (side=2, at=480, cex.axis=1.0, label="8:00") > axis (side=1, at=x_yyyymmdd, labels=format(x_yyyymmdd, "%Y-%m-%d"), > las=2) > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/ > posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
I do not see any difference between the x versus y plot drawn in blue, and the y only plot drawn in red. Is the correct? Greg y_duration <- c (301.59050, 387.35700, 365.64366, 317.26150, 321.71883, 342.44950, 318.95350, 322.33233, 330.60333, 428.99516, 297.82066, 258.23166, 282.01816, 280.00000) x_yyyymmdd <-as.Date(c ("2018-04-25", "2018-04-26", "2018-04-27", "2018-04-28", "2018-04-29", "2018-04-30", "2018-05-01", "2018-05-02", "2018-05-03", "2018-05-04", "2018-05-05", "2018-05-06", "2018-05-07", "2018-05-08)"), format="%Y-%m-%d") plot (x_yyyymmdd, y_duration, type="l", xaxt="n", yaxt="n", ylim=range(240,480), xlab="", ylab="", col="blue") plot ( y_duration, type="l", xaxt="n", yaxt="n", ylim=range(240,480), xlab="", ylab="", col="red" ) [[alternative HTML version deleted]]