fsolt/dotwhisker

faceting etc.

Closed this issue · 1 comments

This is more of a thought than a completely coherently stated issue, but: because of the way the internal machinery is implemented, faceting doesn't work (at least in some cases: see below) when applied to dwplot output. If you were willing to add a dependency to the ggstance package, which has a geom_pointrangeh and position_dodgev, it might be possibly to (1) simplify the internal machinery and (2) make this work out-of-the-box (I realize that the small_multiples() function, which I don't use much, might be an alternative, but it's not as flexible or as transparent as allowing the end user to do faceting ...

Example:

set.seed(101)
dd <- data.frame(term=rep(LETTERS[1:8],2),
                 estimate=rnorm(16),
                 std.error=1,
                 group=factor(rep(rep(1:2,each=4),2)),
                 model=rep(letters[1:2],each=8))
library(dotwhisker)
dwplot(dd)+facet_wrap(~group,scales="free_y")  ## faceting fails/ignored
library(ggstance)
ggplot(dd,aes(x=estimate,
              xmin=estimate-1.96*std.error,xmax=estimate+1.96*std.error,
              y=term,
              colour=model))+
    geom_pointrangeh(position=position_dodgev(height=0.25))+
    facet_wrap(~group,scales="free_y")
fsolt commented

Thanks, Ben. We're hoping to free up some time to work on this this summer.