ggmid.mid.importance {midr} | R Documentation |
Plot MID Importance with ggplot2 Package
Description
For "mid.importance" objects, ggmid()
visualizes the importance of MID component functions.
Usage
## S3 method for class 'mid.importance'
ggmid(
object,
type = c("barplot", "dotchart", "heatmap", "boxplot"),
theme = NULL,
max.bars = 30L,
...
)
## S3 method for class 'mid.importance'
autoplot(object, ...)
Arguments
object |
a "mid.importance" object to be visualized. |
type |
a character string specifying the type of the plot. One of "barplot", "heatmap", "dotchart" or "boxplot". |
theme |
a character string specifying the color theme or any item that can be used to define "color.theme" object. |
max.bars |
an integer specifying the maximum number of bars in the barplot, boxplot and dotchart. |
... |
optional parameters to be passed to the main layer. |
Details
The S3 method of ggmid()
for "mid.importance" objects creates a "ggplot" object that visualizes the term importance of a fitted MID model.
The main layer is drawn using geom_col()
, geom_tile()
, geom_point()
or geom_boxplot()
.
Value
ggmid.mid.importance()
returns a "ggplot" object.
Examples
data(diamonds, package = "ggplot2")
set.seed(42)
idx <- sample(nrow(diamonds), 1e4)
mid <- interpret(price ~ (carat + cut + color + clarity)^2, diamonds[idx, ])
imp <- mid.importance(mid)
ggmid(imp, theme = "Tableau 10")
ggmid(imp, type = "dotchart", theme = "Okabe-Ito", size = 3)
ggmid(imp, type = "heatmap", theme = "Blues")
ggmid(imp, type = "boxplot", theme = "Accent")