pat_multiPlot: Display multiple plots on one page

View source: R/pat_multiPlot.R

pat_multiPlotR Documentation

Display multiple plots on one page

Description

A plotting function that uses ggplot2 to display multiple ggplot objects in a single pane. Can either be passed individual ggplot objects OR a pat object and a plot type. Typical usage would be to supply pat and use the plottype argument to quickly display preformatted plots.

Available plottype options include:

  • "all" – pm25_A, pm25_B, temperature, humidity

  • "pm25_a" – PM2.5 from channel A only

  • "pm25_b" – PM2.5 from channel B only

  • "pm25" – PM2.5 from channels A and B in separate plots

  • "pm25_over" – PM2.5 from channels A and B in the same plot

  • "aux" – auxiliary data (temperature, humidity)

Usage

pat_multiPlot(
  pat = NULL,
  plottype = "all",
  sampleSize = 5000,
  columns = NULL,
  ylim = NULL,
  a_size = 1,
  a_shape = 15,
  a_color = rgb(0.9, 0.25, 0.2),
  b_size = 1,
  b_shape = 15,
  b_color = rgb(0.2, 0.25, 0.9),
  t_size = 1,
  t_shape = 15,
  t_color = "black",
  h_size = 1,
  h_shape = 15,
  h_color = "black",
  alpha = 0.5,
  timezone = NULL
)

pat_multiplot(
  pat = NULL,
  plottype = "all",
  sampleSize = 5000,
  columns = NULL,
  ylim = NULL,
  a_size = 1,
  a_shape = 15,
  a_color = rgb(0.9, 0.25, 0.2),
  b_size = 1,
  b_shape = 15,
  b_color = rgb(0.2, 0.25, 0.9),
  t_size = 1,
  t_shape = 15,
  t_color = "black",
  h_size = 1,
  h_shape = 15,
  h_color = "black",
  alpha = 0.5,
  timezone = NULL
)

Arguments

pat

PurpleAir Timeseries pat object.

plottype

Quick-reference plot types: "all", "aux", "pm25".

sampleSize

Either an integer or fraction to determine sample size.

columns

Number of columns in the plot layout. Use NULL for defaults.

ylim

Vector of (lo,hi) y-axis limits.

a_size

Size of pm25_A points.

a_shape

Symbol to use for pm25_A points.

a_color

Color of pm25_A points.

b_size

Size of pm25_B points.

b_shape

Symbol to use for pm25_B points.

b_color

Color of pm25_B points.

t_size

Size of temperature points.

t_shape

Symbol to use for temperature points.

t_color

Color of temperature points.

h_size

Size of humidity points.

h_shape

Symbol to use for humidity points.

h_color

Color of humidity points.

alpha

Opacity of points.

timezone

Olson timezone used for the time axis. (Defaults to pat local time.)

Value

A ggplot object.

Note

Additional documentation of the multiplot algorithm is available at cookbook-r.com.

Examples


library(AirSensor)

example_pat %>%
  pat_multiPlot(plottype = "pm25", alpha = 0.5)


MazamaScience/AirSensor documentation built on April 28, 2023, 11:16 a.m.