nested_chart: Nested Chart

Description Usage Arguments Details Value See Also Examples

View source: R/nested_chart.R

Description

Creates a nested chart, showing several tests and their facets.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
nested_chart(
  data,
  xarrows = NULL,
  subradius = 0,
  file_name = "none",
  size = 1,
  relative_scaling = 0,
  show_xarrows = FALSE,
  font = "sans",
  rotate_radians = 0,
  rotate_degrees = 0,
  subrotate_radians = 0,
  subrotate_degrees = 0,
  file_width = 10,
  file_height = 10,
  dpi = 500,
  color_global = "black",
  color_nested = "black",
  fade = 85,
  cor_spacing = 0,
  tick = 0,
  dist_construct_label = 10,
  rotate_construct_label_radians = 0,
  rotate_construct_label_degrees = 0,
  dist_test_labels = 2/3,
  rotate_test_labels_radians = 0,
  rotate_test_labels_degrees = 0,
  cor_labels_tests = TRUE,
  cor_labels_facets = TRUE,
  size_construct_label = 1,
  size_test_labels = 1,
  size_facet_labels = 1,
  width_axes = 1,
  width_axes_inner = 1,
  width_circles = 1,
  width_circles_inner = 1,
  width_tick = 1,
  width_tick_inner = 1,
  size_tick_label = 1,
  size_cor_labels = 1,
  size_cor_labels_inner = 1,
  width_xarrows = 1,
  size_xarrow_heads = 1,
  size_xarrow_labels = 1
)

Arguments

data

SEM estimates in the appropriate format, given by the input functions.

xarrows

data frame containing information about additional correlation arrows between facets of different tests; see examples.

subradius

integer; same unit as center distances; radius of the facet circles; defaults to 0, in which case an appropriate value is estimated.

file_name

character; name of the file to save. Supported formats are: "pdf" (highest quality and smallest file size), "png", "jpeg"; defaults to "none".

size

integer; changes the size of most chart objects simultaneously.

relative_scaling

integer; relative size of the global chart scale compared to the nested facet chart scales; defaults to 0, in which case an appropriate value is estimated.

show_xarrows

logical; if TRUE, shows correlation arrows between facets of different tests, according to xarrows.

font

character; text font, use extrafonts to access additional fonts; defaults to "sans", which is "Helvetica".

rotate_radians

integer; radian angle to rotate the chart counter-clockwise by; use fractions of pi (e.g. pi/2 = 90 degrees).

rotate_degrees

integer; angle in degrees to rotate the chart counter-clockwise by.

subrotate_radians

integer; radian angle or vector of radian angles to rotate the nested facet charts counter-clockwise by; use fractions of pi (e.g. pi/2 = 90 degrees).

subrotate_degrees

integer; angle or vector of angles in degrees to rotate the nested facet charts counter-clockwise by.

file_width

integer; file width in inches; defaults to 10.

file_height

integer; file height in inches; defaults to 10.

dpi

integer; resolution in dots per inch for "png" and "jpeg" files; defaults to 500.

color_global

global accent color; defaults to "black".

color_nested

nested accent color; defaults to "black".

fade

integer; brightness of the gray tones between 0 (black) and 100 (white) in steps of 1; defaults to 85.

cor_spacing

integer; if correlations = TRUE: width of the ring, the correlations between tests are drawn in; defaults to 0, in which case an appropriate value is estimated.

tick

numeric; axis tick position; defaults to 0, in which case an appropriate value is estimated.

dist_construct_label

integer; position of the construct label relative to the surrounding circle; defaults to 10, in which case an appropriate value is estimated; a value of .5 would position the label halfway between the center and the surrounding circle.

rotate_construct_label_radians

integer; radian angle to rotate the construct label counter-clockwise by; use fractions of pi (e.g. pi/2 = 90 degrees).

rotate_construct_label_degrees

integer; angle in degrees to rotate the construct label counter-clockwise by.

dist_test_labels

integer; position of the test labels relative to the surrounding circle; defaults to 2/3, in which case the test labels are displayed 2/3 of the way from the centers to the surrounding circles.

rotate_test_labels_radians

integer; radian angle or vector of radian angles to rotate the test labels counter-clockwise by; use fractions of pi (e.g. pi/2 = 90 degrees).

rotate_test_labels_degrees

integer; angle or vector of angle in degrees to rotate the test labels counter-clockwise by.

cor_labels_tests

logical; if TRUE, shows the correlations between tests as text.

cor_labels_facets

logical; if TRUE, shows the correlations between facets as text.

size_construct_label

integer; construct label font size relative to default.

size_test_labels

integer; test label font size relative to default.

size_facet_labels

integer; facet label font size relative to default.

width_axes

integer; global radial axis width relative to default.

width_axes_inner

integer; nested radial axis width relative to default.

width_circles

integer; global circle outline width relative to default.

width_circles_inner

integer; nested circle outline width relative to default.

width_tick

integer; global axis tick line width relative to default.

width_tick_inner

integer; nested axis tick line width relative to default.

size_tick_label

integer; axis tick label font size relative to default.

size_cor_labels

integer; font size of the correlations between tests relative to default.

size_cor_labels_inner

integer; font size of the correlations between facets relative to default.

width_xarrows

integer; extra arrow line width relative to default.

size_xarrow_heads

integer; extra arrow head length relative to default.

size_xarrow_labels

integer; font size of the correlations indicated by extra arrows relative to default.

Details

To get tidy results, it is often required to use rotate_ and subrotate_ for better alignment.

If you set subrotate_ to a single value, all nested facet charts will be rotated by the same amount. If you use a vector of values, the nested facet charts will be rotated one by one by the values from that vector.

Increase relative_scaling to avoid circle overlap. Decrease it to make small chart objects more visible.

correlations and cor_spacing add larger circles around the nested facet charts, but do not change these facet charts.

When changing the size of objects, consider the size parameter first and make specific adjustments with the other size_ and width_ parameters after.

Pdf files will be vector based and can be scaled arbitrarily. For other formats use file_width, file_height, and dpi to avoid later rescaling and loss of quality.

Value

Object of the class "ggplot".

See Also

item_chart facet_chart

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# as simple as that
nested_chart(self_confidence, subradius = .6)

# adding xarrows, in this example for all cases where the correlation between
# facets exceeds the correlation between their respective tests.
sc_arrows <- data.frame(test1 = rep(NA, 3),
                        facet1 = NA,
                        test2 = NA,
                        facet2 = NA,
                        value = NA)
sc_arrows[1, ] <- c("DSSEI", "Ab", "RSES", "Ps", ".67")
sc_arrows[2, ] <- c("DSSEI", "Ab", "SMTQ", "Cs", ".81")
sc_arrows[3, ] <- c("SMTQ", "Ct", "RSES", "Ns", ".76")
nested_chart(self_confidence,
             subradius = .6,
             xarrows = sc_arrows,
             show_xarrows = TRUE)

# rotating the nested facet charts one by one
nested_chart(self_confidence,
             subradius = .6,
             subrotate_radians = c(0, pi / 2, 0))

# test without facets

global <- system.file("extdata", "IPV_global.xlsx", package = "IPV", mustWork = TRUE)
tests <- c(system.file("extdata", "IPV_DSSEI.xlsx", package = "IPV", mustWork = TRUE),
           system.file("extdata", "IPV_SMTQ.xlsx", package = "IPV", mustWork = TRUE),
           NA)
x <- input_excel(global = global, tests = tests)
nested_chart(x)

IPV documentation built on March 13, 2020, 3:03 a.m.