The openaq package provides convenience functions to help plot data
extending the base::plot
function.
To visualize locations on a map, call the plot
function
after returning a data frame from the list_locations
function call. A basic basemap with national boundaries is included
based on the Natural Earth
dataset via the maps
package.
df <- list_locations(
bbox = list(6.291990, 32.823129, 37.932615, 45.181129),
parameters_id = 2,
limit = 1000
)
plot(df)
We can configure and customize the figure using standard
base::plot
parameters in this example coloring the points
by provider and customizing the type of marker used.
plot(df, col = df$providers_id, pch = 20)
The list_sensor_measurements
provides a
base::plot
function to visualize the measurement values as
a time series line chart.
df <- list_sensor_measurements(
3920,
datetime_from = as.POSIXct("2025-01-01 00:00", tz = "America/Denver"),
datetime_to = as.POSIXct("2025-01-15 23:00", tz = "America/Denver"),
)
plot(df)