Usage
## S3 method for class 'default':
rootogram(x, fitted, names = NULL, scale = c("sqrt", "raw"),
type = c("hanging", "standing", "deviation"),
shade = FALSE, legend = TRUE,
legend_args = list(x = 0, y = 0.2, height = 0.6), df = NULL,
rect_gp = NULL, rect_gp_args = list(),
lines_gp = gpar(col = "red", lwd = 2),
points_gp = gpar(col = "red"), pch = 19,
xlab = NULL, ylab = NULL, ylim = NULL,
main = NULL, sub = NULL,
margins = unit(0, "lines"),
title_margins = NULL, legend_width = NULL,
main_gp = gpar(fontsize = 20),
sub_gp = gpar(fontsize = 15),
name = "rootogram", prefix = "",
keep_aspect_ratio = FALSE,
newpage = TRUE, pop = TRUE,
return_grob = FALSE, ...)Arguments
x
either a vector or a 1-way table of frequencies.
fitted
a vector of fitted frequencies.
names
a vector of names passed to grid_barplot, if set
to NULL the names of x are used. scale
a character string indicating whether the values should be
plotted on the raw or square root scale.
type
a character string indicating if the bars for the observed
frequencies should be hanging or standing or indicate the deviation
between observed and fitted frequencies.
shade
logical specifying whether rect_gp should be set
to colors corresponding to the pearson residuals, i.e., if a
residual-based shading should be applied to the bars.
legend
either a legend-generating function, or a legend
function (see details and legends), or a logical.
If legend is NULL or TRUE and gp is a
funct legend_args
list of arguments for the legend-generating
function, if specified.
df
degrees of freedom passed to the shading functions
used for inference.
rect_gp
a "gpar" object controlling the grid graphical
parameters of the rectangles, shading function or a
corresponding generating function (see shadings). If
unspecified and no shading i rect_gp_args
list of arguments for the shading-generating
function, if specified for rect_gp.
lines_gp
a "gpar" object controlling the grid graphical
parameters of the lines.
points_gp
a "gpar" object controlling the grid graphical
parameters of the points.
pch
plotting character for the points.
xlab
a label for the x axis.
ylab
a label for the y axis.
ylim
limits for the y axis.
main
either a logical, or a character string used for plotting
the main title. If main is a logical and TRUE, the
name of the object supplied as x is used.
sub
a character string used for plotting the subtitle.
If sub is a logical and TRUE and main is unspecified, the
name of the object supplied as x is used.
margins
either an object of class "unit" of length 4, or
a numeric vector of length 4. The elements are recycled as needed.
The four components specify the top, right,
bottom, and left margin of the plot, respectively.
When a numeric
title_margins
either an object of class "unit" of length 2, or
a numeric vector of length 2. The elements are recycled as needed.
The two components specify the top and bottom title margin
of the plot, respectively. The default for eac
legend_width
An object of class "unit" of length
1 specifying the width of the legend (if any). Default: 5 lines.
main_gp, sub_gp
object of class "gpar" containing the graphical parameters used for the main (sub) title, if specified.
name
name of the plotting viewport.
keep_aspect_ratio
logical indicating whether the aspect ratio should be fixed or not.
prefix
optional character string used as a prefix for the
generated viewport and grob names.
pop
logical. Should the viewport created be popped?
return_grob
logical. Should a snapshot of the display be
returned as a grid grob?