The plot method for party
and constparty
objects are rather
flexible and can be extended by panel functions. Some pre-defined
panel-generating functions of class grapcon_generator
for the most important cases are documented here.
node_inner(obj, id = TRUE, pval = TRUE, abbreviate = FALSE, fill = "white",
gp = gpar())node_terminal(obj, digits = 3, abbreviate = FALSE,
fill = c("lightgray", "white"), id = TRUE,
just = c("center", "top"), top = 0.85,
align = c("center", "left", "right"), gp = NULL, FUN = NULL,
height = NULL, width = NULL)
edge_simple(obj, digits = 3, abbreviate = FALSE, justmin = Inf,
just = c("alternate", "increasing", "decreasing", "equal"),
fill = "white")
node_boxplot(obj, col = "black", fill = "lightgray", bg = "white", width = 0.5,
yscale = NULL, ylines = 3, cex = 0.5, id = TRUE, mainlab = NULL, gp = gpar())
node_barplot(obj, col = "black", fill = NULL, bg = "white",
beside = NULL, ymax = NULL, ylines = NULL, widths = 1, gap = NULL,
reverse = NULL, rot = 0, just = c("center", "top"), id = TRUE,
mainlab = NULL, text = c("none", "horizontal", "vertical"), gp = gpar())
node_surv(obj, col = "black", bg = "white", ylines = 2,
id = TRUE, mainlab = NULL, gp = gpar(), …)
node_ecdf(obj, col = "black", bg = "white", ylines = 2,
id = TRUE, mainlab = NULL, gp = gpar(), …)
node_bivplot(mobobj, which = NULL, id = TRUE, pop = TRUE,
pointcol = "black", pointcex = 0.5,
boxcol = "black", boxwidth = 0.5, boxfill = "lightgray",
bg = "white", fitmean = TRUE, linecol = "red",
cdplot = FALSE, fivenum = TRUE, breaks = NULL,
ylines = NULL, xlab = FALSE, ylab = FALSE, margins = rep(1.5, 4),
mainlab = NULL, …)
node_mvar(obj, which = NULL, id = TRUE, pop = TRUE, ylines = NULL,
mainlab = NULL, varlab = TRUE, bg = "white", ...)
an object of class party
.
integer, used for formating numbers.
logical indicating whether strings should be abbreviated.
a color for points and lines.
a color to filling rectangles and backgrounds.
logical. Should node IDs be plotted?
logical. Should node p values be plotted (if they are available)?
justification of terminal panel viewport (node_terminal
),
or labels (edge_simple
, node_barplot
).
minimum average edge label length to employ justification
via just
in edge_panel
, otherwise just = "equal"
is used. Thus, by default "equal"
justification is always used
but other justifications could be employed for finite justmin
.
in case of top justification, the npc coordinate at which the viewport is justified.
alignment of text within terminal panel viewport.
number of lines for spaces in y-direction.
widths in barplots.
width in boxplots (called width
in node_boxplot
).
gap between bars in a barplot (node_barplot
).
limits in y-direction
upper limit in y-direction
character extension of points in scatter plots.
logical indicating if barplots should be side by side or stacked.
logical indicating whether the order of levels should be reversed for barplots.
arguments passed to grid.text
for the
x-axis labeling.
graphical parameters.
function for formatting the info
, passed to formatinfo_node
.
numeric, number of lines/columns for printing text.
an object of class modelparty
as computed by mob
.
numeric or character. Optional selection of subset of regressor variables. By default one panel for each regressor variable is drawn.
logical. Should the viewports in the individual nodes be popped after drawing?
logical. Should the fitted mean function be visualized?
logical. Should a CD plot (or a spineplot) be drawn when the response variable is categorical?
logical. Should the five-number summary be used for splitting the x-axis in spineplots?
numeric. Optional numeric vector with breaks for the x-axis in splineplots.
character. Optional annotation for x-axis and y-axis.
numeric. Margins around drawing area in viewport.
character or function. An optional title for the plot. Either
a character or a function(id, nobs)
.
logical. Should the individual variable labels be attached to
the mainlab
for multivariate responses?
logical or character. Should percentage labels be drawn
for each bar? The default is "none"
or equivalently FALSE
.
Can be set to TRUE
(or "horizontal"
) or alternatively
"vertical"
.
additional arguments passed to callies
(for example to survfit
).
The plot
methods for party
and constparty
objects provide an
extensible framework for the visualization of binary regression trees. The
user is allowed to specify panel functions for plotting terminal and inner
nodes as well as the corresponding edges. The panel functions to be used
should depend only on the node being visualized, however, for setting up
an appropriate panel function, information from the whole tree is typically
required. Hence, party adopts the framework of grapcon_generator
(graphical appearance control) from the vcd package (Meyer, Zeileis and
Hornik, 2005) and provides several panel-generating functions. For convenience,
the panel-generating functions node_inner
and edge_simple
return panel functions to draw inner nodes and left and right edges.
For drawing terminal nodes, the functions returned by the other panel
functions can be used. The panel generating function node_terminal
is a terse text-based representation of terminal nodes.
Graphical representations of terminal nodes are available and depend on the kind of model and the measurement scale of the variables modeled.
For univariate regressions (typically fitted by ),
node_surv
returns a functions that plots Kaplan-Meier curves in each
terminal node; node_barplot
, node_boxplot
, node_hist
, node_ecdf
and
node_density
can be used to plot bar plots, box plots, histograms,
empirical cumulative distribution functions and
estimated densities into the terminal nodes.
For multivariate regressions (typically fitted by mob
),
node_bivplot
returns a panel function that creates bivariate plots
of the response against all regressors in the model. Depending on the scale
of the variables involved, scatter plots, box plots, spinograms (or CD plots)
and spine plots are created. For the latter two spine
and
cd_plot
from the vcd package are re-used.
For multivariate responses in ctree
, the panel function node_mvar
generates one plot for each response.
Meyer D, Zeileis A, Hornik K (2006). The Strucplot Framework: Visualizing Multi-Way Contingency Tables with vcd. Journal of Statistical Software, 17(3), 1--48. http://www.jstatsoft.org/v17/i03/