View source: R/create_stick_plot.R
create_stick_plot | R Documentation |
Function returns a plot object showing vertical/horizontal lines that run from a base value to a measurement value. Options are provided for scaling.
create_stick_plot(
df,
base_val = 0,
aes_x = NULL,
aes_y = NULL,
aes_color = NULL,
title = NULL,
subtitle = NULL,
caption = NULL,
center_titles = FALSE,
x_title = NULL,
y_title = NULL,
hide_x_tics = FALSE,
hide_y_tics = FALSE,
rot_x_tic_angle = 0,
rot_y_tic_label = FALSE,
x_limits = NULL,
x_major_breaks = waiver(),
x_minor_breaks = waiver(),
x_labels = waiver(),
x_major_date_breaks = waiver(),
x_date_labels = waiver(),
y_limits = NULL,
y_major_breaks = waiver(),
y_minor_breaks = waiver(),
y_labels = waiver(),
axis_text_size = 11,
line_color = "black",
line_width = 0.8,
line_type = "solid",
line_alpha = 1,
show_major_grids = TRUE,
show_minor_grids = TRUE,
panel_color = "white",
panel_border_color = "black",
show_legend = TRUE,
legend_pos = "right",
legend_key_width = 1.5,
legend_key_height = 1.5,
legend_key_backgrd = "white",
bold_y = NULL,
bold_y_color = "black",
silent_NA_warning = FALSE,
png_file_path = NULL,
png_width_height = c(480, 480)
)
df |
The target data frame from which the "stick" lines are drawn. |
base_val |
A numeric that sets the base value from which the "stick" originates. The default value is 0. |
aes_x |
Sets the x axis variable name from |
aes_y |
Sets the y axis variable name from |
aes_color |
Sets the variable name from |
title |
A string that sets the plot title. |
subtitle |
A string that sets the plot subtitle. |
caption |
A string that sets the plot caption |
center_titles |
A logical which if |
x_title |
A string that sets the x axis title. If NULL (the default) then the x axis title does not appear. |
y_title |
A string that sets the y axis title. If NULL (the default) then the y axis title does not appear. |
hide_x_tics |
A logical that controls the appearance of the x axis tics. |
hide_y_tics |
A logical that controls the appearance of the y axis tics. |
rot_x_tic_angle |
A numeric that sets the angle of rotation for the x tic labels. When x tic labels are long, a value of 40 for this argument usually works well. |
rot_y_tic_label |
A logical which if TRUE rotates the y tic labels 90 degrees for enhanced readability. |
x_limits |
Depending on the class of |
x_major_breaks |
Depending on the class of |
x_minor_breaks |
Depending on the class of |
x_labels |
A character vector with the same length as |
x_major_date_breaks |
If the class of |
x_date_labels |
If the class of |
y_limits |
A numeric 2 element vector that sets the minimum and maximum for the y axis. Use NA to refer to the existing minimum and maximum. |
y_major_breaks |
A numeric vector or function that defines the exact major tic locations along the y axis. |
y_minor_breaks |
A numeric vector or function that defines the exact minor tic locations along the y axis. |
y_labels |
A character vector with the same length as |
axis_text_size |
A numeric that sets the font size along the axis'. Default is 11. |
line_color |
A string that sets the color attribute of the lines. |
line_width |
A numeric value that sets the width of lines. |
line_type |
A string that sets the linetype. The default is "solid". |
line_alpha |
A numeric value that sets the degree of color alpha attribute for the lines. |
show_major_grids |
A logical that controls the appearence of major grids. |
show_minor_grids |
A logical that controls the appearence of minor grids. |
panel_color |
A string in hexidecimal or color name that sets the plot panel's color. The default is "white". |
panel_border_color |
A string in hexidecimal or color name that sets the plot panel's border color. The default is "black". |
show_legend |
A logical that controls the appearence of the legend. |
legend_pos |
A string that sets the legend position. Acceptable values are "top", "bottom", "left", "right". |
legend_key_width |
A numeric that sets the legend width in cm. |
legend_key_height |
A numeric that sets the legend height in cm. |
legend_key_backgrd |
A string that sets the legend's background color. |
bold_y |
A numeric that plots a bold horizontal line at this y value. |
bold_y_color |
A string that sets the bold horizontal line color. Default is "black". |
silent_NA_warning |
A logical that controls the appearance of a console warning when NA's are removed. |
png_file_path |
A character string with the directory and file name to produce a png image of the plot. |
png_width_height |
A numeric vector that sets the width and height of the png image in pixels. The default is c(480,480). There are 37.8 pixels in a centimeter. |
A plot object
Rick Dean
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.