Plot grouped proportional crosstables, where the proportion of
each level of x
for the highest category in y
is plotted, for each subgroup of groups
.
sjp.gpt(x, y, groups, geom.colors = "Set1", geom.size = 2.5, shape.fill.color = "#f0f0f0", shapes = c(15, 16, 17, 18, 21, 22, 23, 24, 25, 7, 8, 9, 10, 12), title = NULL, axis.labels = NULL, axis.titles = NULL, legend.title = NULL, legend.labels = NULL, wrap.title = 50, wrap.labels = 15, wrap.legend.title = 20, wrap.legend.labels = 20, axis.lim = NULL, grid.breaks = NULL, show.total = TRUE, annotate.total = TRUE, show.p = TRUE, show.n = TRUE, prnt.plot = TRUE)
x | Categorical variable, where the proportion of each category in
|
---|---|
y | Categorical or numeric variable. If not a binary variable, |
groups | Grouping variable, which will define the y-axis |
geom.colors | user defined color for geoms. See 'Details' in |
geom.size | size resp. width of the geoms (bar width, line thickness or point size, depending on plot type and function). Note that bar and bin widths mostly need smaller values than dot sizes. |
shape.fill.color | Optional color vector, fill-color for non-filled shapes |
shapes | Numeric vector with shape styles, used to map the different
categories of |
title | character vector, used as plot title. Depending on plot type and function,
will be set automatically. If |
axis.labels | character vector with labels used as axis labels. Optional argument, since in most cases, axis labels are set automatically. |
axis.titles | character vector of length one or two, defining the title(s) for the x-axis and y-axis. |
legend.title | character vector, used as title for the plot legend. |
legend.labels | character vector with labels for the guide/legend. |
wrap.title | numeric, determines how many chars of the plot title are displayed in one line and when a line break is inserted. |
wrap.labels | numeric, determines how many chars of the value, variable or axis labels are displayed in one line and when a line break is inserted. |
wrap.legend.title | numeric, determines how many chars of the legend's title are displayed in one line and when a line break is inserted. |
wrap.legend.labels | numeric, determines how many chars of the legend labels are displayed in one line and when a line break is inserted. |
axis.lim | Numeric vector of length 2, defining the range of the plot axis.
Depending on plot type, may effect either x- or y-axis, or both.
For multiple plot outputs (e.g., from |
grid.breaks | numeric; sets the distance between breaks for the axis,
i.e. at every |
show.total | Logical, if |
annotate.total | Logical, if |
show.p | Logical, adds significance levels to values, or value and variable labels. |
show.n | logical, if |
prnt.plot | logical, if |
(Insisibily) returns the ggplot-object with the complete plot
(plot
) as well as the data frame that
was used for setting up the ggplot-object (df
).
The p-values are based on chisq.test
of x
and y
for each groups
.
data(efc) # the proportion of dependency levels in female # elderly, for each family carer's relationship # to elderly sjp.gpt(efc$e42dep, efc$e16sex, efc$e15relat)# proportion of educational levels in highest # dependency category of elderly, for different # care levels sjp.gpt(efc$c172code, efc$e42dep, efc$n4pstu)