GiovineItalia / Gadfly.jl

Crafty statistical graphics for Julia.
http://gadflyjl.org/stable/
Other
1.9k stars 250 forks source link

Add Geom.linerange and Geom.pointrange? #512

Open awellis opened 9 years ago

awellis commented 9 years ago

Is there an easy way to add line ranges (and point ranges)? In ggplot I can do:

geom_pointrange(aes(y = median, ymin = lower95, ymax = upper95), size = 1.5)

and

geom_linerange(aes(ymin = lower90, ymax = upper90)

I need this to plot highest density intervals for regression coefficients. I could use errorbars, but there I can't change the line width.

dcjones commented 9 years ago

I don't understand why this can't be done with Geom.errorbar. I haven't used this in ggplot2 before, but geom_linerange seems like the same thing as errorbar.

awellis commented 9 years ago

I wanted to something like this:

geom_pointrange(aes(y = median,
                        ymin = lower95,
                        ymax = upper95),
                    size = 1.5) +
    geom_linerange(aes(ymin = lower90,
                       ymax = upper90),
                   size = 2.5) 

i.e. I want to plot the 90% and 95% credible intervals using different line widths, similar to this:

http://rgm3.lab.nig.ac.jp/RGM/R_rdfile?f=mcmcplots/man/caterplot.Rd&d=R_CC

As far as I can tell, error bar doesn't allow me to specify the line with, or at least I can't figure out how to do it.