A matrix question asks 2 or more rows against one shared response scale
(a "grid" of Likert items). Plotting each row as its own separate
sframe_draw_likert_diverging() chart loses the grouping the question
was designed with, so this draws every row as one diverging bar inside a
single chart, sharing one x scale and one legend, the standard way a
Likert matrix is reported (compare a typical multi-item satisfaction
grid). Same diverging-stack convention as the single-item chart: the
middle category of an odd-length scale is neutral and split evenly
across the zero line, and colour saturation increases toward each pole.
Usage
sframe_plot_likert_matrix(item, data, choice_set, palette = c("web", "print"))Arguments
- item
A
"matrix"sframe item, withmatrix_items(the row labels) and achoice_setnaming the shared response scale.- data
The response data.frame, with one expanded
<item id>__<row label>column per matrix row, as produced byread_responses().- choice_set
The item's choice set object (
values,labels), typically looked up frominstrument$choicesbyitem$choice_set.- palette
One of
"web"or"print". Seesframe_brand().
See also
Other Chart functions:
plot.sframe_analysis_results(),
sframe_plot_cooccurrence(),
sframe_plot_cooccurrence_network(),
sframe_plot_correlation_matrix(),
sframe_plot_decision_ranking(),
sframe_plot_dematel_influence(),
sframe_plot_descriptives(),
sframe_plot_efa_loadings(),
sframe_plot_efa_scree(),
sframe_plot_group_comparison(),
sframe_plot_likert_scale(),
sframe_plot_missingness(),
sframe_plot_ngram_frequency(),
sframe_plot_paired_comparison(),
sframe_plot_quality(),
sframe_plot_regression_diagnostics(),
sframe_plot_reliability(),
sframe_plot_sentiment(),
sframe_plot_term_frequency(),
sframe_plot_topics(),
sframe_plot_validity(),
sframe_plot_variable_distribution(),
sframe_plots,
theme_surveyframe()
Examples
# \donttest{
if (requireNamespace("ggplot2", quietly = TRUE)) {
demo <- sframe_demo("matrix_likert")
item <- Filter(function(i) i$type == "matrix", demo$instrument$items)[[1]]
cs <- Filter(function(c) c$id == item$choice_set, demo$instrument$choices)[[1]]
sframe_plot_likert_matrix(item, demo$responses, cs)
}
# }