Closed chr1swallace closed 6 years ago
Issue confirmed:
library(dotwhisker)
#> Loading required package: ggplot2
m1 <- lm(mpg ~ wt + cyl + disp + gear, data = mtcars)
m2 <- update(m1, . ~ . + hp) # add another predictor
m3 <- update(m2, . ~ . + am) # and another
dwplot(list(m1, m2, m3), order_vars = c("cyl", "disp", "gear", "wt", "am", "hp"))
Created on 2018-07-03 by the reprex package (v0.2.0).
Thanks for checking! With https://github.com/chr1swallace/dotwhisker seems fixed:
And your fix works:
library(dotwhisker)
#> Loading required package: ggplot2
m1 <- lm(mpg ~ wt + cyl + disp + gear, data = mtcars)
m2 <- update(m1, . ~ . + hp) # add another predictor
m3 <- update(m2, . ~ . + am) # and another
dwplot(list(m1, m2, m3), order_vars = c("cyl", "disp", "gear", "wt", "am", "hp"))
Created on 2018-07-03 by the reprex package (v0.2.0).
Thanks, Chris! I appreciate your help with this!
If I use order_vars with a list of regressions, only the first gets plotted. I think that's because in this line in dwplot, match() selects the first match https://github.com/fsolt/dotwhisker/blob/2f5fa24235662baf34e4173ab41e9eaee029d5e2/R/dwplot.R#L132
I think this is fixed by replacing the line with