textCentralityPlot: Plot words according to semantic similarity to the aggregated...

View source: R/4_1_textPlotCentrality.R

textCentralityPlotR Documentation

Plot words according to semantic similarity to the aggregated word embedding.

Description

Plot words according to semantic similarity to the aggregated word embedding.

Usage

textCentralityPlot(
  word_data,
  min_freq_words_test = 1,
  plot_n_word_extreme = 10,
  plot_n_word_frequency = 10,
  plot_n_words_middle = 10,
  titles_color = "#61605e",
  x_axes = "central_semantic_similarity",
  title_top = "Semantic Centrality Plot",
  x_axes_label = "Semantic Centrality",
  scale_x_axes_lim = NULL,
  scale_y_axes_lim = NULL,
  word_font = NULL,
  centrality_color_codes = c("#EAEAEA", "#85DB8E", "#398CF9", "#9e9d9d"),
  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.5,
  points_without_words_alpha = 0.5,
  legend_title = "SC",
  legend_x_axes_label = "x",
  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 = 1007
)

Arguments

word_data

Tibble from textPlotData.

min_freq_words_test

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

plot_n_word_extreme

Number of words per dimension to plot with extreme Supervised Dimension Projection value. (i.e., even if not significant; duplicates are removed).

plot_n_word_frequency

Number of words to plot according to their frequency. (i.e., even if not significant).

plot_n_words_middle

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

titles_color

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

x_axes

Variable to be plotted on the x-axes (default is "central_semantic_similarity", could also select "n", "n_percent").

title_top

Title (default " ").

x_axes_label

Label on the x-axes.

scale_x_axes_lim

Length of the x-axes (default: NULL, which uses c(min(word_data$central_semantic_similarity)-0.05, max(word_data$central_semantic_similarity)+0.05); change this by e.g., try c(-5, 5)).

scale_y_axes_lim

Length of the y-axes (default: NULL, which uses c(-1, 1); change e.g., by trying c(-5, 5)).

word_font

Type of font (default: NULL).

centrality_color_codes

Colors of the words selected as plot_n_word_extreme (minimum values), plot_n_words_middle, plot_n_word_extreme (maximum values) and plot_n_word_frequency; the default is c("#EAEAEA", "#85DB8E", "#398CF9", "#9e9d9d", respectively.

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 to a word (default is to not show the point; , i.e., 0).

points_without_words_alpha

Transparency of the points that are not linked to a word (default is to not show it; i.e., 0).

legend_title

Title of the color legend (default: "(SCP)").

legend_x_axes_label

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

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 of the title (default = 7).

legend_number_size

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

seed

Set different seed.

Value

A 1-dimensional word plot based on similarity to the aggregated word embedding, as well as tibble with processed data used to plot.

See Also

see textCentrality and textProjection

Examples

# The test-data included in the package is called: centrality_data_harmony
names(centrality_data_harmony)
# Plot
# centrality_plot <- textCentralityPlot(
#  word_data = centrality_data_harmony,
#  min_freq_words_test = 10,
#  plot_n_word_extreme = 10,
#  plot_n_word_frequency = 10,
#  plot_n_words_middle = 10,
#  titles_color = "#61605e",
#  x_axes = "central_semantic_similarity",
#
#  title_top = "Semantic Centrality Plot",
#  x_axes_label = "Semantic Centrality",
#
#  word_font = NULL,
#  centrality_color_codes = c("#EAEAEA", "#85DB8E", "#398CF9", "#9e9d9d"),
#  word_size_range = c(3, 8),
#  point_size = 0.5,
#  arrow_transparency = 0.1,
#  points_without_words_size = 0.5,
#  points_without_words_alpha = 0.5,
# )
# centrality_plot

text documentation built on Aug. 9, 2023, 5:08 p.m.