On Mon, Aug 9, 2010 at 1:19 AM, George Chen <glc...@stanford.edu> wrote: > Hi All, > > I am plotting vertical lines using xyplot in lattice and type="h". > It works well, but the problem is that the tops of the lines are convex and > the bottoms are concave. > Is there a way to flatten the tops and bottoms? > > Here's my code: > > Source<-matrix(1:30,10,3) > colnames(Source)<-c("x","y1","y2") > Source<-data.frame(Source) > > xyplot(y2+y1~x, > data=Source, > distribute.type=TRUE, > type=c("h","h"), > col=c("black","white"), > lwd=20) > graphics.off()
An additional note: If you actually want segments, then it would be more natural to use library(latticeExtra) segplot(x ~ y2 + y1, data = Source, horizontal = FALSE, col=c("black"), lwd=20) To get flattened corners, you could use segplot(x ~ y2 + y1, data = Source, horizontal = FALSE, col=c("black"), lwd=20, lineend = "butt") -Deepayan ______________________________________________ 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.