Dot-and-Whisker Plots of Regression Results

Quick and easy dot-and-whisker plots of regression results.


dwplot is a function for quickly and easily generating dot-and-whisker plots of regression models saved in tidy data frames. It provides a convenient way to create highly customizable plot for presenting and comparing statistics. Users can use it to plot coefficients or other estimates (e.g., predicted probabilities) within a model or compare them across different models. The estimates are presented as dots with confidential interval whiskers, and grouped based on variables.

To install:

  • the latest released version: install.packages("dotwhisker").
  • the latest developing version: devtools::install_github("fsolt/dotwhisker").

More detail are introducted at:


Version 0.5.0

New features

  1. The vline argument is now available for dwplot(). Passing a geom_vline() object to this argument, typically one with xintercept = 0, will plot this line behind the plotted coefficients, which most will find aesthetically preferable. The default for this argument is NULL, so if you prefer not to include such lines or just like them plotted last and foremost, there's no need to change your code.

  2. dwplot() now again accepts the whisker_arg argument to change the appearance of the whiskers representing the confidence intervals that has been lost since v0.3.0. This means you can, for example, specify different colors for the dots and the whiskers:

# load the library
#> Loading required package: ggplot2
# linear model of interest
lm_object <- stats::lm(formula = wt ~ am * cyl, data = mtcars)
# creating the plot with dwplot
dwplot(x = lm_object,
       dot_args = list(color = "red"), # color for the dot
       whisker_args = list(color = "black"),   # color for the whisker
       vline = ggplot2::geom_vline(xintercept = 0,  # put vline _behind_ coefs
                                   colour = "grey60",
                                   linetype = 2,
                                   size = 1))

Created on 2018-06-27 by the reprex package (v0.2.0).

Version 0.4.1

Bug fixes

  1. Fixed a bug in add_brackets() that caused brackets to overlap in large models or when many models were included in a single plot.

Version 0.4.0

New features

  1. A new plot style! Specifying style = "distribution" in the arguments to dwplot() presents regression coefficients as normal distributions, underscored with a line representing the desired confidence interval.
  2. relabel_predictors() now conveniently reorders the predictors as well.
  3. add_brackets() can now be added directly to the end of a chain of commands that generate a dotwhisker plot; the intermediate object necessary in past versions is no longer needed. Just wrap the plotting commands in braces ({ and }) before piping them to add_brackets()!

Syntax changes

  1. The alpha argument to dwplot() should no longer be used to change the width of confidence intervals; use (to be passed to broom::tidy via ...) instead.
  2. When dwplot() is passed model objects rather than a tidy data frame, the regression coefficients are now rescaled by two standard deviations of their respective variables in the analysed data (per by_2sd()) by default. This may be changed by setting by_2sd = FALSE.

Bug fixes

  1. Fixed a bug in add_brackets() that de-centered the brackets
  2. Fixed a bug that caused dot_args to be ignored after plots were passed to relabel_predictors()
  3. Fixed a bug that prevented small_multiple() from directly reading confidence intervals from a model.
  4. Fixed a bug in by_2sd() now adjusts, if present, any confidence intervals in tidy data frames passed to the function.

Thanks to Steven V. Miller and Ryan Burge for bug reports, and to Ben Edwards and Jay Jacobs for inspiring style = "distribution"!

Version 0.3.0

  1. Rewrote the plotting functions based on the ggstance functions. The new dwplot allows cooperating with more ggplot functions, such as facet_*.
  2. Drew whiskers based on the CI estimates directly from the model output. See more details in tidy.lm and confint.
  3. Clarified the description of by_2sd.

Version 0.2.6

  1. Fixed the bug in relabel_predictors.

Version 0.2.5

  1. Expanded capabilities of relabel_predictors. relabel_predictors now accepts plots as well as tidy dataframes as input; that is, it may now be used both before and after calls to dwplot.
  2. Deprecated relabel_y_axis. It is easy to mistakenly mislabel variables with relabel_y_axis, and it has a conflict with add_brackets in single-model plots.
  3. Provided example of using multiple shapes for multiple models in vignette.
  4. dwplot works for polr projects.

Version 0.2.4

  1. Improved the presentation of small_multiple.

Version 0.2.3

  1. Fixed the error of variable ordering with a single model.

Version 0.2.2

  1. Fixed the error in presenting multiple models.

Version 0.2.1

  1. Fixed the error due to the update of dplyr::group_by
  2. Fixing the errors in vignette.
  3. Adding the show_intercept argument.
  4. Shorten the version number to three digits as devtools suggests.


  1. Fixed the error due to the update of gridExtra.
  2. Fixed the error due to the update of ggplot2.


  1. Fixed presenting error in multilevel models (#44)


  1. Fixed the link error in kl2007_example.Rmd.


  1. Improving the vignette.
  2. The function works for ggplot2 2.0.0.


  1. Fixed the error in the vignette.


  1. Allowing directly using model objects besides tidy data.frame.
  2. Adding two new special plotting functions: secret_weapon and small_multiple.
  3. Adding two graph adjusting functions: relabel_predictor and relabel_y_axis.

More details about the new functions are available in the vignette.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.7.4 by Yue Hu, 3 months ago

Report a bug at

Browse source code at

Authors: Frederick Solt [aut] , Yue Hu [aut, cre] , Os Keyes [ctb] , Ben Bolker [ctb] , Stefan Müller [ctb] , Thomas Leeper [ctb] , Chris Wallace [ctb] , Christopher Warshaw [ctb]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports grid, stats, parameters, margins, dplyr, stringr, ggstance, rlang, purrr, gtable

Depends on ggplot2

Suggests ordinal, tibble, gridExtra, knitr, rmarkdown, broom

Imported by drhur.

Suggested by broom.mixed, glmmTMB, nlmixr, tidybayes.

See at CRAN