create_range_plot: Function wraps ggplot2 geom_pointrange to produce x/y plot of...

View source: R/create_range_plot.R

create_range_plotR Documentation

Function wraps ggplot2 geom_pointrange to produce x/y plot of numeric ranges.

Description

Function returns a ggplot2 plot object displaying the individual spread or vertical interval/range for a collection of x/y pairs of points.

Usage

create_range_plot(
  df,
  aes_x = NULL,
  aes_y = NULL,
  aes_y_min = NULL,
  aes_y_max = 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,
  y_limits = NULL,
  y_major_breaks = waiver(),
  y_minor_breaks = waiver(),
  y_labels = waiver(),
  y_log10 = FALSE,
  axis_text_size = 11,
  pts_fill = "white",
  pts_shape = 21,
  pts_stroke = 1,
  line_type = "solid",
  line_width = 1,
  fatten_pts = 4,
  line_pts_color = "black",
  line_pts_alpha = 1,
  panel_color = "white",
  panel_border_color = "black",
  show_major_grids = TRUE,
  show_minor_grids = TRUE,
  do_coord_flip = FALSE,
  silent_NA_warning = FALSE,
  png_file_path = NULL,
  png_width_height = c(480, 480)
)

Arguments

df

The target data frame from which the point ranges are plotted.

aes_x

Sets the x axis variable name from df. It is a factor type variable that is associated with aes_y.

aes_y

Sets a y axis variable name from df. These are the required numeric values that defines the location of the range on the y axis.

aes_y_min

A string that sets a y axis variable name from df. These are the required numerics that defines the minimum values for the range of aes_y.

aes_y_max

A string that sets a y axis variable name from df. These are the required numerics that defines the maximum values for the range of aes_y.

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 TRUE centers both the title and subtitle.

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.

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 y_major_breaks, that labels the major tics.

y_log10

A logical which if TRUE will use a log10 scale for the y axis.

axis_text_size

A numeric that sets the font size along the axis'. Default is 11.

pts_fill

A string that sets the fill color of the points.

pts_shape

A numeric integer that sets the shape of the points. Typical values are 21 “circle”, 22 “square”, 23 “diamond”, 24 “up triangle”, 25 “down triangle”.

pts_stroke

A numeric that sets the drawing width for a point shape.

line_type

A string that sets range line type twodash, solid, longdash, dotted, dotdash, dashed, blank.

line_width

A numeric that sets the width of the lines.

fatten_pts

A multiplicative numeric that sets the size of points(diameter).

line_pts_color

A string that sets the color of the range lines and outlines of the points.

line_pts_alpha

A numeric value that sets the alpha level of points.

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_major_grids

A logical that controls the appearance of major grids.

show_minor_grids

A logical that controls the appearance of minor grids.

do_coord_flip

A logical which if TRUE will flip the x and y axis'.

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.

Value

A plot object

Author(s)

Rick Dean


deandevl/RplotterPkg documentation built on Feb. 1, 2024, 8:02 p.m.