[R] Does anybody know how to control the appearance of the end of the line in lattice?

p_connolly at slingshot.co.nz p_connolly at slingshot.co.nz
Mon Aug 9 01:11:17 CEST 2010


On Sun, 08-Aug-2010 at 12:49PM -0700, George Chen 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?

The bottom isn't concave.  You've drawn a white line which has
semi-circular ends (as is the default) over the black one.

I'm having difficulty imagining what your real objective is, but if
you want to change the way the end of lines are drawn, it's simple in
base graphics using the 'lend' parameter (but it doesn't work with all
devices according to the help file for par).

If you are using xyplot because you want to use the neat things you
can do with lattice, I think you'll have to go about it a slightly
more complicated way.  Use lpolygon in a panel function to draw
polygons and fill them.

HTH



|>
|> 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()
|>
|> Thanks.
|>
|> George Chen
|>
|> ______________________________________________
|> R-help at 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.

--
Patrick Connolly
Plant & Food Research
Mt Albert
Auckland
New Zealand
Ph: +64-9 925 7079
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it.  ---Steven Wright
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~



More information about the R-help mailing list