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 in a global chart.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
nested_chart(data, xarrows = NULL, subradius, filename = "myipv.pdf",
  size = 1, relative_scaling = 3, show_xarrows = FALSE, font = "sans",
  rotate_radians = 0, rotate_degrees = 0, subrotate_radians = 0,
  subrotate_degrees = 0, filewidth = 10, fileheight = 10,
  colour_tests = "black", colour_facets = "black", fade = 85,
  correlations = TRUE, cor_spacing = 0.4, tick = 0.1,
  rotate_title_radians = 0, rotate_title_degrees = 0,
  cor_labels_tests = TRUE, cor_labels_facets = TRUE, size_title = 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, size_center_dot = 1,
  size_center_dot_inner = 1, width_xarrows = 1, size_xarrow_heads = 1,
  size_xarrow_labels = 1)

Arguments

data

list generated by input_excel, or by hand, containing formatted data.

xarrows

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

subradius

integer; (arbitrary) radius of the circles representing facets (same unit as center distances), use to avoid circle overlap and optimize appearance.

filename

character; name of the file to save. Supported formats are: "pdf" (best quality with lowest file size), "png", "jpeg". Use "none" to suppress file output; defaults to "myipv.pdf".

size

integer; smartly scaled size of chart objects.

relative_scaling

integer; relative size of the global chart compared to the nested facet charts; defaults to 3.

show_xarrows

logical; if TRUE, draws correlation arrows between facets of different tests.

font

character; text font; defaults to 'sans' (use extrafonts to install additional fonts).

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 in degrees or vector of angles in degrees to rotate the nested facet charts counter-clockwise by.

filewidth

integer; width of the graphic in inches; defaults to 10, dpi is 3000 for pdf files and 500 for png and jpeg files.

fileheight

integer; height of the graphic in inches; defaults to 10, dpi is 3000 for pdf files and 500 for png and jpeg files.

colour_tests

character; name of the global accent colour.

colour_facets

character; name of the nested accent colour.

fade

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

correlations

logical; if TRUE, generates coordinates for latent correlations between tests and sets up a ring to draw them in. If FALSE, the ring and the correlations are omitted, simplifying the chart significantly.

cor_spacing

integer; if correlations = TRUE: width of the ring the latent correlations between tests are drawn in; defaults to 0.4.

tick

numeric; axis tick position; defaults to .1.

rotate_title_radians

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

rotate_title_degrees

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

cor_labels_tests

logical; if TRUE, draws latent correlations between tests as text.

cor_labels_facets

logical; if TRUE, draws latent correlations between facets as text.

size_title

integer; font size of the global label (relative to default).

size_test_labels

integer; font size of the test labels (relative to default).

size_facet_labels

integer; font size of the facet labels (relative to default).

width_axes

integer; width of the global radial axis lines indicating center distances (relative to default).

width_axes_inner

integer; width of the nested radial axis lines indicating center distances (relative to default).

width_circles

integer; width of the global circle outlines (relative to default).

width_circles_inner

integer; width of the nested circle outlines (relative to default).

width_tick

integer; width of the global dotted axis tick line (relative to default).

width_tick_inner

integer; width of the nested dotted axis tick line (relative to default).

size_tick_label

integer; font size of the axis tick label (relative to default).

size_cor_labels

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

size_cor_labels_inner

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

size_center_dot

integer; size of the center dot marking the global origin (relative to default).

size_center_dot_inner

integer; size of the center dots marking the nested origins (relative to default).

width_xarrows

integer; width of the extra arrow lines (relative to default).

size_xarrow_heads

integer; length of the extra arrow heads (relative to default).

size_xarrow_labels

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

Details

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.

The nested chart treats tests like facets of a global factor. It uses facet charts for tests similar to how facet charts use circles for facets.

Value

Object of the class "ggplot" and optionally the same object saved as a file.

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
# as simple as that
nested_chart(self_confidence, subradius = .6)

# adding xarrows
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))

NilsPetras/IPV documentation built on Dec. 7, 2018, 8:55 a.m.