Plot words according to Supervised Dimension Projection.

textProjectionPlot(
  word_data,
  k_n_words_to_test = FALSE,
  min_freq_words_test = 1,
  min_freq_words_plot = 1,
  plot_n_words_square = 3,
  plot_n_words_p = 5,
  plot_n_word_extreme = 5,
  plot_n_word_frequency = 5,
  plot_n_words_middle = 5,
  titles_color = "#61605e",
  y_axes = FALSE,
  p_alpha = 0.05,
  p_adjust_method = "none",
  title_top = "Supervised Dimension Projection",
  x_axes_label = "Supervised Dimension Projection (SDP)",
  y_axes_label = "Supervised Dimension Projection (SDP)",
  scale_x_axes_lim = NULL,
  scale_y_axes_lim = NULL,
  word_font = NULL,
  bivariate_color_codes = c("#398CF9", "#60A1F7", "#5dc688", "#e07f6a", "#EAEAEA",
    "#40DD52", "#FF0000", "#EA7467", "#85DB8E"),
  word_size_range = c(3, 8),
  position_jitter_hight = 0,
  position_jitter_width = 0.03,
  point_size = 0.5,
  arrow_transparency = 0.1,
  points_without_words_size = 0.2,
  points_without_words_alpha = 0.2,
  legend_title = "DPP",
  legend_x_axes_label = "x",
  legend_y_axes_label = "y",
  legend_x_position = 0.02,
  legend_y_position = 0.02,
  legend_h_size = 0.2,
  legend_w_size = 0.2,
  legend_title_size = 7,
  legend_number_size = 2,
  seed = 1005
)

Arguments

word_data

Dataframe from textProjection

k_n_words_to_test

Select the k most frequent words to significance test (k = sqrt(100*N); N = number of participant responses). Default = TRUE.

min_freq_words_test

Select words to significance test that have occurred at least min_freq_words_test (default = 1).

min_freq_words_plot

Select words to plot that has occurred at least min_freq_words_plot times.

plot_n_words_square

Select number of significant words in each square of the figure to plot. The significant words, in each square is selected according to most frequent words.

plot_n_words_p

Number of significant words to plot on each(positive and negative) side of the x-axes and y-axes, (where duplicates are removed); selects first according to lowest p-value and then according to frequency. Hence, on a two dimensional plot it is possible that plot_n_words_p = 1 yield 4 words.

plot_n_word_extreme

Number of words that are extreme on Supervised Dimension Projection per dimension. (i.e., even if not significant; per dimensions, where duplicates are removed).

plot_n_word_frequency

Number of words based on being most frequent. (i.e., even if not significant).

plot_n_words_middle

Number of words plotted that are in the middle in Supervised Dimension Projection score (i.e., even if not significant; per dimensions, where duplicates are removed).

titles_color

Color for all the titles (default: "#61605e")

y_axes

If TRUE, also plotting on the y-axes (default is FALSE). Also plotting on y-axes produces a two dimension 2-dimensional plot, but the textProjection function has to have had a variable on the y-axes.

p_alpha

Alpha (default = .05).

p_adjust_method

Method to adjust/correct p-values for multiple comparisons (default = "holm"; see also "none", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr").

title_top

Title (default " ")

x_axes_label

Label on the x-axes.

y_axes_label

Label on the y-axes.

scale_x_axes_lim

Manually set the length of the x-axes (default = NULL, which uses ggplot2::scale_x_continuous(limits = scale_x_axes_lim); change e.g., by trying c(-5, 5)).

scale_y_axes_lim

Manually set the length of the y-axes (default = NULL; which uses ggplot2::scale_y_continuous(limits = scale_y_axes_lim); change e.g., by trying c(-5, 5)).

word_font

Font type (default: NULL).

bivariate_color_codes

The different colors of the words. Note that, at the moment, two squares should not have the exact same colour-code because the numbers within the squares of the legend will then be aggregated (and show the same, incorrect value). (default: c("#398CF9", "#60A1F7", "#5dc688", "#e07f6a", "#EAEAEA", "#40DD52", "#FF0000", "#EA7467", "#85DB8E")).

word_size_range

Vector with minimum and maximum font size (default: c(3, 8)).

position_jitter_hight

Jitter height (default: .0).

position_jitter_width

Jitter width (default: .03).

point_size

Size of the points indicating the words' position (default: 0.5).

arrow_transparency

Transparency of the lines between each word and point (default: 0.1).

points_without_words_size

Size of the points not linked with a words (default is to not show it, i.e., 0).

points_without_words_alpha

Transparency of the points not linked with a words (default is to not show it, i.e., 0).

legend_title

Title on the color legend (default: "(SDP)".

legend_x_axes_label

Label on the color legend (default: "(x)".

legend_y_axes_label

Label on the color legend (default: "(y)".

legend_x_position

Position on the x coordinates of the color legend (default: 0.02).

legend_y_position

Position on the y coordinates of the color legend (default: 0.05).

legend_h_size

Height of the color legend (default 0.15).

legend_w_size

Width of the color legend (default 0.15).

legend_title_size

Font size (default: 7).

legend_number_size

Font size of the values in the legend (default: 2).

seed

Set different seed.

Value

A 1- or 2-dimensional word plot, as well as tibble with processed data used to plot.

See also

Examples

# The test-data included in the package is called: DP_projections_HILS_SWLS_100 # Supervised Dimension Projection Plot plot_projection <- textProjectionPlot( word_data = DP_projections_HILS_SWLS_100, k_n_words_to_test = FALSE, min_freq_words_test = 1, plot_n_words_square = 3, plot_n_words_p = 3, plot_n_word_extreme = 1, plot_n_word_frequency = 1, plot_n_words_middle = 1, y_axes = FALSE, p_alpha = 0.05, title_top = "Supervised Dimension Projection (SDP)", x_axes_label = "Low vs. High HILS score", y_axes_label = "Low vs. High SWLS score", p_adjust_method = "bonferroni", scale_y_axes_lim = NULL ) plot_projection
#> $final_plot
#> #> $description #> [1] "INFORMATION ABOUT THE PROJECTION INFORMATION ABOUT THE PLOT word_data = DP_projections_HILS_SWLS_100 k_n_words_to_test = FALSE min_freq_words_test = 1 min_freq_words_plot = 1 plot_n_words_square = 3 plot_n_words_p = 3 plot_n_word_extreme = 1 plot_n_word_frequency = 1 plot_n_words_middle = 1 y_axes = FALSE p_alpha = 0.05 p_adjust_method = bonferroni bivariate_color_codes = #398CF9 #60A1F7 #5dc688 #e07f6a #EAEAEA #40DD52 #FF0000 #EA7467 #85DB8E word_size_range = 3 - 8 position_jitter_hight = 0 position_jitter_width = 0.03 point_size = 0.5 arrow_transparency = 0.5 points_without_words_size = 0.2 points_without_words_alpha = 0.2 legend_x_position = 0.02 legend_y_position = 0.02 legend_h_size = 0.2 legend_w_size = 0.2 legend_title_size = 7 legend_number_size = 2" #> #> $processed_word_data #> # A tibble: 583 x 23 #> words dot.x p_values_dot.x n_g1.x n_g2.x dot.y p_values_dot.y n_g1.y #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 able 6.86e-1 0.194 NA 1 2.31 0.0123 NA #> 2 acce… 1.52e+0 0.0272 -1 2 1.15 0.0620 -1 #> 3 acco… 2.14e+0 0.00856 NA 1 3.51 0.00273 NA #> 4 acti… 1.23e+0 0.0503 NA 1 1.56 0.0361 NA #> 5 adap… -3.87e-4 0.969 -1 NA 0.331 0.476 -1 #> 6 admi… 5.14e-1 0.315 NA 1 1.52 0.0398 NA #> 7 adri… -3.79e+0 0.00000100 -1 NA -3.60 0.00000100 -1 #> 8 affi… 7.49e-1 0.150 NA 1 2.04 0.0184 NA #> 9 agre… 2.23e+0 0.00626 NA 1 1.69 0.0312 NA #> 10 alco… -5.51e-1 0.318 -1 NA -1.07 0.0605 -1 #> # … with 573 more rows, and 15 more variables: n_g2.y <dbl>, n <int>, #> # n.percent <dbl>, N_participant_responses <int>, adjusted_p_values.x <dbl>, #> # square_categories <dbl>, check_p_square <dbl>, check_p_x_neg <dbl>, #> # check_p_x_pos <dbl>, check_extreme_max_x <dbl>, check_extreme_min_x <dbl>, #> # check_extreme_frequency_x <dbl>, check_middle_x <dbl>, #> # extremes_all_x <dbl>, colour_categories <chr> #>
names(DP_projections_HILS_SWLS_100)
#> [1] "words" "dot.x" #> [3] "p_values_dot.x" "n_g1.x" #> [5] "n_g2.x" "dot.y" #> [7] "p_values_dot.y" "n_g1.y" #> [9] "n_g2.y" "n" #> [11] "n.percent" "N_participant_responses"