View source: R/plot_state_frequencies.R
| mosaic_plot | R Documentation |
Draws a Hartigan-Friendly mosaic (marimekko geometry, chi-square
standardized-residual fill) for an integer-weighted network. Equivalent in
algorithm and appearance to tna::plot_mosaic(); named differently to
avoid an export clash when both packages are attached.
mosaic_plot(x, ...)
## Default S3 method:
mosaic_plot(x, ...)
## S3 method for class 'netobject'
mosaic_plot(
x,
xlab = NULL,
ylab = NULL,
range = NULL,
top_angle = NULL,
left_angle = NULL,
residuals = c("permutation", "asymptotic"),
n_perm = 500L,
seed = NULL,
values = FALSE,
style = c("classic", "flat"),
...
)
## S3 method for class 'htna'
mosaic_plot(
x,
xlab = NULL,
ylab = NULL,
range = NULL,
top_angle = NULL,
left_angle = NULL,
residuals = c("permutation", "asymptotic"),
n_perm = 500L,
seed = NULL,
values = FALSE,
style = c("classic", "flat"),
...
)
## S3 method for class 'mcml'
mosaic_plot(
x,
level = c("macro", "clusters"),
xlab = NULL,
ylab = NULL,
range = NULL,
top_angle = NULL,
left_angle = NULL,
residuals = c("permutation", "asymptotic"),
n_perm = 500L,
seed = NULL,
ncol = 2L,
values = FALSE,
style = c("classic", "flat"),
...
)
## S3 method for class 'netobject_group'
mosaic_plot(
x,
xlab = NULL,
ylab = NULL,
range = NULL,
top_angle = NULL,
left_angle = NULL,
residuals = c("permutation", "asymptotic"),
n_perm = 500L,
seed = NULL,
ncol = 2L,
values = FALSE,
style = c("classic", "flat"),
...
)
## S3 method for class 'table'
mosaic_plot(
x,
xlab = "Row",
ylab = "Column",
range = NULL,
top_angle = NULL,
left_angle = NULL,
residuals = c("permutation", "asymptotic"),
n_perm = 500L,
seed = NULL,
values = FALSE,
style = c("classic", "flat"),
...
)
## S3 method for class 'matrix'
mosaic_plot(x, ...)
x |
One of the four data-bearing Nestimate classes:
|
... |
Flat styling overrides forwarded to the flat renderer when
|
xlab, ylab |
Axis labels. |
range |
Numeric of length 2 giving the lower and upper colour-scale
limits for the standardized residual. |
top_angle, left_angle |
Rotation in degrees for the top (x) and left
(y) tick labels. |
residuals |
One of |
n_perm |
Number of permutations when |
seed |
Optional integer seed for the permutation RNG. Use for
reproducible plots; ignored when |
values |
Logical. When |
style |
Character. |
level |
For |
ncol |
For |
Column widths are proportional to row marginals of the weight matrix
(incoming totals when the matrix is transposed, as for transitions). Within
each column, segment heights are proportional to that row's conditional
distribution. Cell fill is the standardized residual from
stats::chisq.test(), with a diverging palette clipped to \pm 4.
Mosaics need integer counts: when $weights is already integer
(method = "frequency" / "co_occurrence") it is used directly;
for a single netobject / htna otherwise (relative, glasso,
cor, ...) order-1 transition counts are recounted from the raw $data
sequences. The function errors only when neither integer weights nor
$data are available.
A ggplot object (or a gtable from
gridExtra::arrangeGrob for netobject_group when
gridExtra is available).
plot_mosaic for the lower-level data.frame primitive.
## Not run:
net <- build_network(group_regulation, method = "frequency")
mosaic_plot(net)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.