I would like to plot the results of a GAM as dot-and-whisker plots using the dwplot() command in the dotwhisker R package. The example in the package documentation is as follows:
#Package preload
library(dotwhisker)
library(broom)
library(dplyr)
# run a regression compatible with tidy
m1 <- lm(mpg ~ wt + cyl + disp + gear, data = mtcars)
m1_df <- tidy(m1) # create data.frame of regression results
m1_df # a tidy data.frame available for dwplot
dwplot(m1_df) #same as dwplot(m1)
I have two questions:
- I only want to plot two of the coefficients. How could I change the command to plot only, say, wt and cyl and exclude disp and gear.
- How can I make the whiskers go vertically instead of horizontally (like in a "small multiple" plot, small_multiple())
Thanks,
Josh