Hi,
You could use ?rect
x = 1:5
y=1:5
plot(x,y,t="n",xaxs="i")
abline(h=y)
xlims = range(x)
y.rect = matrix(rep(y,each=2)[-c(1, 2*length(y))], ncol=2, byrow=T)
x.rect = matrix(rep(xlims), ncol=2,nrow=nrow(y.rect), byrow=T)
cols = 1:4
rect(x.rect[,1], y.rect[,1], x.rect[,2], y.rect[,2],col=cols)
and more generally ?polygon
HTH,
baptiste
2009/7/4 Hannu Kahra <hkahra@gmail.com>
> Hi,
>
> I have a graph with seven parallel horizontal lines. Is it possible to
> shade the area between two adjacent lines?
>
> Thank you in advance,
> Hannu
>
> ______________________________________________
> R-help@r-project.org mailing list
> 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.
>
--
_____________________________
Baptiste AuguiƩ
School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK
Phone: +44 1392 264187
http://newton.ex.ac.uk/research/emag
______________________________
[[alternative HTML version deleted]]