Description Usage Arguments Examples
Make a spider web plot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | spider_web(
df,
grp_col = "nm",
spk_col = "spk",
value_col = "value",
spoke_color = "grey75",
spoke_lty = 1,
ref_lines_val = c(0.5, 0.75, 1),
ref_lines_color = rep("grey75", length(ref_lines_val)),
ref_lines_type = rep(1, length(ref_lines_val)),
ref_label_color = rep("grey50", length(ref_lines_val)),
ref_lines_label_spoke = c(length(unique(df[, spk_col, drop = TRUE])),
length(unique(df[, spk_col, drop = TRUE])), 0),
diff_lty_by_name = "ref",
diff_lty = 2,
lwd = 1,
palette = "Set2",
show_legend = TRUE,
leg_main_title = "Legend",
leg_lty_title = "Linetype",
return_data = FALSE
)
|
df |
A data.frame representing groups and spokes for the plot (see examples) |
grp_col |
The name of the column used for groups |
spk_col |
The name of the column used for spokes |
value_col |
The name of the column used for the values of each group along the spokes |
spoke_color |
Single value for color of the spokes |
spoke_lty |
Single integer value for the line type of the spokes |
ref_lines_val |
A vector of reference line values to plot |
ref_lines_color |
A vector of reference line colors |
ref_lines_type |
vector of reference line types |
ref_label_color |
A vector of reference label colors |
ref_lines_label_spoke |
A vector of reference label locations (spoke number). A value of zero means that the label will not be printed |
diff_lty_by_name |
This is an optional string which will be used to |
diff_lty |
Line type to use for |
lwd |
Line width for the main coloured lines. |
palette |
As defined in |
show_legend |
Show legend? |
leg_main_title |
Main legend title |
leg_lty_title |
Linetype legend title |
return_data |
Logical? Return the data instead of the plot? |
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 | df <- data.frame(
nm = c(
"A", "B", "C",
"A", "B", "C",
"A", "B", "C",
"A", "B", "C",
"A", "B", "C"
),
spk = c(
"P1", "P1", "P1",
"P2", "P2", "P2",
"P3", "P3", "P3",
"P4", "P4", "P4",
"P5", "P5", "P5"
),
value = c(
.1, .2, .3,
.4, .5, .6,
.7, .8, .9,
.10, .11, .12,
.13, .14, .15
)
)
spider_web(df,
ref_lines_label_spoke = c(4, 3, 0),
ref_lines_type = c(2, 3, 4),
ref_lines_color = c("black", "royalblue", "salmon")
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.