Skip to contents
library(coefplot)
#> Loading required package: ggplot2
dt <- mtcars
dt$cyl <- as.factor(dt$cyl)
model <- lm(mpg ~ wt*disp + cyl, data = dt)

Default arguments

coefplot(model)

Labels

title, xlab, and ylab

coefplot(
  model,
  title = 'This is my `coefplot`',
  xlab = 'Coefficient Values',
  ylab = 'Variables'
)

textAngle and numberAngle

coefplot(
  model,
  textAngle = 90,
  numberAngle = 45
)

Coefficients

newNames

coefplot(
  model,
  newNames = c('cyl' = 'Cylinder', 'disp' = 'Displacement', 'wt' = 'Weight')
)

predictors, strict, and coefficient

coefplot(
  model,
  predictors = c('wt')
)


coefplot(
  model,
  predictors = c('wt', 'disp'),
  strict = TRUE
)


coefplot(
  model,
  coefficient = c('wt', 'cyl')
)

innerCI/outerCI and lwdInner/lwdOuter and pointSize

coefplot(
  model,
  innerCI = 1.5,
  lwdInner = 2,
  outerCI = 3,
  lwdOuter = .5,
  pointSize = 3.5
)

color, shape, and linetype

See the ggplot2 documentation on differentiation to learn more.

coefplot(
  model,
  color = 'red',
  shape = 23,
  outerType = 2
)

intercept

coefplot(
  model,
  intercept = FALSE
)

Display

interactive

coefplot(
  model,
  interactive = TRUE
)

trans

coefplot(
  model,
  trans = \(x) { x * .1 }
)

zeroColor, zeroLWD, and zeroType

coefplot(
  model,
  zeroColor = 'red',
  zeroLWD = 2,
  zeroType = 'dotdash'
)

facet and scales

coefplot(
  model,
  facet = TRUE,
  scales = 'free'
)

sort and decreasing

coefplot(
  model,
  sort = 'alphabetical'
)


coefplot(
  model,
  decreasing = TRUE
)