fsolt/dotwhisker

Plot with binary x with `small_multiple`

Closed this issue · 0 comments

ggplot2 2.2.0 leaves a blank column when presenting models. This leads to an ugly white stick between models in the small_multiple outputs and stretching the plot when there are small numbers of compared models. The example codes are following:

m <- list()
ordered_vars <- c("wt", "cyl", "disp", "hp", "gear", "am")
m[[1]] <- lm(mpg ~ wt, data = mtcars)
m123456_df <- m[[1]] %>% tidy %>% by_2sd(mtcars) %>%
    mutate(model = "Model 1")

for (i in 2:6) {
    m[[i]] <- update(m[[i-1]], paste(". ~ . +", ordered_vars[i]))
    m123456_df <- rbind(m123456_df, m[[i]] %>% tidy %>% by_2sd(mtcars) %>%
                            mutate(model = paste("Model", i)))
}


x <- m123456_df[1:5,]

small_multiple(x)