plot  R Documentation 
A generic plotmethod for ggeffects
objects.
## S3 method for class 'ggeffects'
plot(
x,
show_ci = TRUE,
ci_style = c("ribbon", "errorbar", "dash", "dot"),
show_data = FALSE,
show_residuals = FALSE,
show_residuals_line = FALSE,
data_labels = FALSE,
limit_range = FALSE,
collapse_group = FALSE,
show_legend = TRUE,
show_title = TRUE,
show_x_title = TRUE,
show_y_title = TRUE,
case = NULL,
colors = NULL,
alpha = 0.15,
dot_alpha = 0.35,
jitter = NULL,
dodge = 0.25,
dot_size = NULL,
line_size = NULL,
use_theme = TRUE,
log_y = FALSE,
connect_lines = FALSE,
facets,
grid,
one_plot = TRUE,
n_rows = NULL,
verbose = TRUE,
ci = show_ci,
ci.style = ci_style,
rawdata = show_data,
add.data = show_data,
residuals = show_residuals,
residuals.line = show_residuals_line,
label.data = data_labels,
limit.range = limit_range,
collapse.group = collapse_group,
dot.alpha = dot_alpha,
dot.size = dot_size,
line.size = line_size,
connect.lines = connect_lines,
show.title = show_title,
show.x.title = show_x_title,
show.y.title = show_y_title,
use.theme = use_theme,
show.legend = show_legend,
one.plot = one_plot,
log.y = log_y,
...
)
theme_ggeffects(base_size = 11, base_family = "")
show_pals()
x 
An object of class 
show_ci 
Logical, if 
ci_style 
Character vector, indicating the style of the confidence
bands. May be either 
show_data 
Logical, if 
show_residuals 
Logical, if 
show_residuals_line 
Logical, if 
data_labels 
Logical, if 
limit_range 
Logical, if 
collapse_group 
For mixed effects models, name of the grouping variable
of random effects. If 
show_legend 
Logical, shows or hides the plot legend. 
show_title 
Logical, shows or hides the plot title 
show_x_title 
Logical, shows or hides the plot title for the xaxis. 
show_y_title 
Logical, shows or hides the plot title for the yaxis. 
case 
Desired target case. Labels will automatically converted into the
specified character case. See 
colors 
Character vector with color values in hexformat, valid
color value names (see Following options are valid for

alpha 
Alpha value for the confidence bands. 
dot_alpha 
Alpha value for data points, when 
jitter 
Numeric, between 0 and 1. If not 
dodge 
Value for offsetting or shifting error bars, to avoid overlapping.
Only applies, if a factor is plotted at the xaxis (in such cases, the
confidence bands are replaced by error bars automatically), or if

dot_size 
Numeric, size of the point geoms. 
line_size 
Numeric, size of the line geoms. 
use_theme 
Logical, if 
log_y 
Logical, if 
connect_lines 
Logical, if 
facets , grid 
Logical, defaults to 
one_plot 
Logical, if 
n_rows 
Number of rows to align plots. By default, all plots are aligned in one row. For facets, or multiple panels, plots can also be aligned in multiiple rows, to avoid that plots are too small. 
verbose 
Logical, toggle warnings and messages. 
ci , add.data , rawdata , residuals , residuals.line , label.data , limit.range , collapse.group , dot.alpha , dot.size , line.size , connect.lines , show.title , show.x.title , show.y.title , use.theme , one.plot , ci.style , show.legend , log.y 
Deprecated
arguments. Use 
... 
Further arguments passed down to 
base_size 
Base font size. 
base_family 
Base font family. 
For proportional odds logistic regression (see ?MASS::polr
)
or cumulative link models in general, plots are automatically facetted
by response.level
, which indicates the grouping of predictions based on
the level of the model's response.
A ggplot2object.
For generalized linear models (glms), residualized scores are
computed as inv.link(link(Y) + r)
where Y
are the predicted
values on the response scale, and r
are the working residuals.
For (generalized) linear mixed models, the random effect are also
partialled out.
Load library(ggplot2)
and use theme_set(theme_ggeffects())
to set
the ggeffectstheme as default plotting theme. You can then use further
plotmodifiers, e.g. from sjPlot, like legend_style()
or font_size()
without losing the thememodifications.
There are predefined colour palettes in this package. Use show_pals()
to show all available colour palettes.
library(sjlabelled)
data(efc)
efc$c172code < as_label(efc$c172code)
fit < lm(barthtot ~ c12hour + neg_c_7 + c161sex + c172code, data = efc)
dat < predict_response(fit, terms = "c12hour")
plot(dat)
# facet by group, use predefined color palette
dat < predict_response(fit, terms = c("c12hour", "c172code"))
plot(dat, facet = TRUE, colors = "hero")
# don't use facets, b/w figure, w/o confidence bands
dat < predict_response(fit, terms = c("c12hour", "c172code"))
plot(dat, colors = "bw", show_ci = FALSE)
# factor at x axis, plot exact data points and error bars
dat < predict_response(fit, terms = c("c172code", "c161sex"))
plot(dat)
# for three variables, automatic facetting
dat < predict_response(fit, terms = c("c12hour", "c172code", "c161sex"))
plot(dat)
# show all color palettes
show_pals()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.