fsolt/dotwhisker

Allow geom_vline() behind points?

leeper opened this issue · 1 comments

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

Thanks, Thomas!