aqiColors: Generate AQI colors

View source: R/aqiColors.R

aqiColorsR Documentation

Generate AQI colors

Description

This function uses the leaflet::colorBin() function to return a vector or matrix of colors derived from data values.

Usage

aqiColors(
  x,
  pollutant = c("PM2.5", "AQI", "CO", "NO", "OZONE", "PM10", "SO2"),
  palette = c("EPA", "subdued", "deuteranopia"),
  na.color = NA
)

Arguments

x

Vector or matrix of PM2.5 values or an mts_monitor object.

pollutant

EPA AQS criteria pollutant.

palette

Named color palette to use for AQI categories.

na.color

Color assigned to missing values.

Value

A vector or matrix of AQI colors to be used in maps and plots.

Examples

library(AirMonitor)

# Fancy plot based on pm2.5 values
pm2.5 <- Carmel_Valley$data[,2]
Carmel_Valley %>%
  monitor_timeseriesPlot(
    shadedNight = TRUE,
    pch = 16,
    cex = pmax(pm2.5 / 100, 0.5),
    col = aqiColors(pm2.5),
    opacity = 0.8
  )

AirMonitor documentation built on Aug. 26, 2023, 1:08 a.m.