[R] color of error bars in Dotplot (Hmisc)

Dieter Menne dieter.menne at menne-biomed.de
Wed Jul 27 14:35:04 CEST 2011


Irene Prix wrote:
> 
> 
> In a grouped Dotplot, is there any way to set the color of error bars to
> be the same as the corresponding symbols?
> ...
> require(lattice)
> require(Hmisc)
> data(barley)
> 
> Dotplot(variety~Cbind(yield, yield+2, yield-2)|year, groups=site,
> data=barley)
> 
> 

Customizations of this type can require tricky-digging into the code.
Dotplot calls panel.dotplot, where you find a line

plot.line <- trellis.par.get(if (gp)    "superpose.line"  else "plot.line")

gp=TRUE when there are groups. So let's give it a try (thanks for the
self-contained example code)

# using global assignment here, better use local
superpose.line = trellis.par.get("superpose.line")
superpose.line
superpose.line$col=c("black","green","red")
superpose.line$lwd=3
trellis.par.set("superpose.line",superpose.line)

Dotplot(variety~Cbind(yield, yield+2, yield-2)|year, groups=site,
data=barley)
----

The good news: the lines are black. The bad news: they are all black, which
is the first term. So it looks like these lines are not vectorized (Frank,
correct me....)

You might be able to get customized results with panel.arrow.

Dieter







--
View this message in context: http://r.789695.n4.nabble.com/color-of-error-bars-in-Dotplot-Hmisc-tp3697678p3698327.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list