fsolt / dotwhisker

Dot-and-Whisker Plots of Regression Results
https://fsolt.org/dotwhisker/
Other
57 stars 10 forks source link

Allow geom_vline() behind points? #84

Closed leeper closed 6 years ago

leeper commented 6 years ago

It would be awesome if it were possible to draw the geom_vline() behind the points and error bars. At present, it has to be added as a subsequent layer which makes it the topmost layer, which I find aesthetically unsatisfying.

I think you could simply add a vline = NULL default argument and then change these lines to:

        p <- ggplot(df, aes(x = estimate, xmin = conf.low, xmax = conf.high,
                            y = stats::reorder(term, y_ind), colour = model)) +
            vline + 
            do.call(ggstance::geom_pointrangeh, point_args) +
            ylab("") + xlab("")

By default then, nothing would be drawn but users could pass their own geom_vline() object in place.

fsolt commented 6 years ago

Thanks, Thomas!