geom_errorbarh width parameter doesn't work

120 views
Skip to first unread message

Peter Meilstrup

unread,
Mar 29, 2010, 8:08:50 PM3/29/10
to ggplot2
I can use geom_errorbar to draw error bars and use the 'width'
parameter to adjust how wide the marks at the limits of the error bars
are drawn. However, when I try to do the same with geom_errorbarh, the
'width' parameter seems to have no effect. Anyone have this working?

Peter

hadley wickham

unread,
Mar 29, 2010, 11:05:31 PM3/29/10
to Peter Meilstrup, ggplot2
Hi Peter,

You want height, not width.

Hadley

> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> To post to this group, send email to ggp...@googlegroups.com
> To unsubscribe from this group, send email to
> ggplot2+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/ggplot2
>
> To unsubscribe from this group, send email to ggplot2+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
>

--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

Peter Meilstrup

unread,
Mar 30, 2010, 3:40:06 PM3/30/10
to hadley wickham, ggplot2
Hi Hadley,

height isn't working for me either. Here's the example from the docs
with a height parameter added, the end marks get drawn about 0.9 units
tall no matter what I put in the height parameter.

###
df <- data.frame(
trt = factor(c(1, 1, 2, 2)),
resp = c(1, 5, 3, 4),
group = factor(c(1, 2, 1, 2)),
se = c(0.1, 0.3, 0.3, 0.2)
)

p <- ggplot(df, aes(resp, trt, fill = group))
p + geom_point() + geom_errorbarh(aes(xmax = resp + se, xmin = resp -
se), height=0.25)
###

Peter

hadley wickham

unread,
Apr 6, 2010, 11:27:16 AM4/6/10
to Peter Meilstrup, ggplot2
Hi Peter,

Try putting height in the aes. (You shouldn't have to, but I think
there might be a bug here)

Hadley

On Tue, Mar 30, 2010 at 1:40 PM, Peter Meilstrup

Reply all
Reply to author
Forward
0 new messages