legend associated to geom_pointrange

348 views
Skip to first unread message

dani

unread,
Apr 30, 2009, 9:11:52 AM4/30/09
to ggplot2
Hi all,

I am using geom_pointrange to create a scatter plot for several
conditions that I map to different colors. The problem I have is that
the legend shows thick lines that dont look very good. I want to plot
points in the legend for example.

I can use geom_point and geom_linerange separately including
legend=FALSE for the last one, but the problem is that I am using
jittering to avoid overplotting and naturally the jitter for the
points and error bars should be the same so I guess I cannot use these
to geoms separately.

The following toy code shows the thick lines in the legend I am
talking about:

df<-data.frame(x=c(1,2),y=c(2,3),ymin=c(1.8,2.7),ymax=c(2.2,3.1))
p<-ggplot(data=df,aes(x=x,y=y,ymin=ymin,ymax=ymax,color="condition"))
p + geom_pointrange()

thanks

dani

--
Daniel Linares
web: www.dlinares.org

hadley wickham

unread,
Apr 30, 2009, 10:50:10 AM4/30/09
to dani, ggplot2
Hi Dani,

It looks fine to me. Do you have the latest version of ggplot2? (0.8.3)

Hadley
--
http://had.co.nz/

Dani Linares

unread,
Apr 30, 2009, 12:10:12 PM4/30/09
to hadley wickham, ggplot2
I didnt have the latest version. I installed it and now it works fine.
Thanks a lot.

dani
Reply all
Reply to author
Forward
0 new messages