| spiro_plot | R Documentation | 
spiro_plot() returns a ggplot2 graph visualizing data from
cardiopulmonary exercise testing.
spiro_plot(
  data,
  which = 1:9,
  smooth = "fz",
  base_size = 13,
  style_args = list(),
  grid_args = list(),
  vert_lines = FALSE
)
| data | A  | 
| which | A numeric integer setting the plot panels to be displayed. The panels are numbered in the order of the traditional Wasserman 9-Panel Plot: 
 | 
| smooth | Parameter giving the filter methods for smoothing the data.
Default is  | 
| base_size | An integer controlling the base size of the plots (in pts). | 
| style_args | A list of arguments controlling the color and size of lines and points. See the section 'Customization' for possible arguments. Additional arguments are passed to ggplot2::theme() to modify the appearance of the plots. | 
| grid_args | A list of arguments passed to  | 
| vert_lines | Whether vertical lines should be displayed at the time points of the first warm-up load, first load, and last load. Defaults to FALSE. | 
This function provides a shortcut for visualizing data from metabolic carts
processed by the spiro function.
There are three ways to customize the appearance of plots in
spiro_plot. First, you can control the color and size of points and
lines with the style_args argument. For a list of available arguments
that should be passed in form of a list, see below. Second, you can change
the appearance of axis and plot elements (e.g, axis titles, panel lines) by
passing arguments over to ggplot2::theme() via the style_args
argument. Third, you can modify the arrangement of plots by the which
argument and customize the arrangement by passing arguments to
cowplot::plot_grid() via the grid_args argument.
size = 2Defines the size of all points
linewidth = 1Defines the width of all lines
color_VO2 = "#c00000", color_VCO2 = "#0053a4",
color_VE = "#003300", color_VT = "grey30",
color_RER = "#003300", color_HR = "red",
color_pulse = "pink"
Define the color of lines and points in the following plot panels: VO2 (panel 3,6,9), VCO2 (3,4,5,6,9), VE (1), VT (7), RER (8), HR (2,5), pulse (2)
Are passed to ggplot2::theme()
A ggplot object.
# Import and process example data
ramp_data <- spiro(
  file = spiro_example("zan_ramp"),
  hr_file = spiro_example("hr_ramp.tcx")
)
# Display the traditional Wasserman 9-Panel Plot
spiro_plot(ramp_data)
# Display selected panels, here V-Slope
spiro_plot(ramp_data, which = 5)
# Modify the arrangement of plots by passing arguments to
# cowplot::plot_grid() via the grid_args argument
spiro_plot(ramp_data, which = c(4, 5, 6, 8), grid_args = list(nrow = 1))
# Modify the appearance of plots using the style_args argument
spiro_plot(ramp_data, style_args = list(size = 0.3, color_VCO2 = "black"))
# Modify the appearance of plots by passing arguments to ggplot2::theme() via
# the style_args argument
spiro_plot(ramp_data,
  style_args = list(axis.title.x = ggplot2::element_text(colour = "green"))
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.