1. Not reproducible since my.settings, dat_key, sdate not provided. 2. Why did you not try something like ylim = c(-5,80) ?
Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Sep 11, 2017 at 12:33 PM, Maria Lathouri via R-help < r-help@r-project.org> wrote: > Dear all > I am trying to make a plot in xyplot lattice by groups. I would like to > show "0" in y axis but I don't want to be aligned with the x axis. I want > to be a little bit above. > I have tried many options but I don't get what I want. I also tried > ylim=c(0, 80) but both 0 and 80 are fully aligned with the x-axis and the > upper boundary of the plot, respectively: > xyplot(upper.zn + Zn2 + lower.zn ~ sdate | Location, type="b", > as.table=TRUE, data=dat, pch=c(22, 21, 22), lty=c(2, 1, 2), ylim=c(0, 80), > index.cond=list(c(3, 1, 2)), ylab="Percent (%)", > par.strip.text=list(col="white", font=2, lines=1.5), > lattice.options = modifyList(lattice.options(), > list(skip.boundary.labels = 0)), > par.settings=my.settings, col=c("red", "black", "red"), > fill=c("red", "black", "red"), > key=dat_key, scales = list(x = list(at = sdate, labels = > format(sdate, "%b-%y"))), xlab="Date", > panel = function(x, y, ...) { > panel.grid(h = -1, v = 0, lwd=1, lty=3, col="grey") > panel.abline(v=sdate, lwd=1, lty=3, col="grey") > panel.xyplot(x, y, ...) > } > ) > when I use the following, 80 is a bit lower than the upper boundary of the > plot, which is what I want, but 0 is not showing: > xyplot(upper.zn + Zn2 + lower.zn ~ sdate | Location, type="b", > as.table=TRUE, data=dat, pch=c(22, 21, 22), lty=c(2, 1, 2), > index.cond=list(c(3, 1, 2)), ylab="Percent (%)", > par.strip.text=list(col="white", font=2, lines=1.5), > lattice.options = modifyList(lattice.options(), > list(skip.boundary.labels = 0)), > par.settings=my.settings, col=c("red", "black", "red"), > fill=c("red", "black", "red"), > key=dat_key, scales = list(x = list(at = sdate, labels = > format(sdate, "%b-%y")), y=list(at=c(0, 20, 40, 60, 80))), xlab="Date", > panel = function(x, y, ...) { > panel.grid(h = -1, v = 0, lwd=1, lty=3, col="grey") > panel.abline(v=sdate, lwd=1, lty=3, col="grey") > panel.xyplot(x, y, ...) > } > )I have also attached a reproducible example in case you want to > see in more detail my data. > I would very much appreciate any suggestions on this. > Thank you in advance. > Kind regards,Maria > ______________________________________________ > R-help@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]] ______________________________________________ R-help@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.