covidcast_signalobject as choropleths, bubbles, or time series
Several plot types are provided, including choropleth plots (maps), bubble
plots, and time series plots showing the change of signals over time, for a
data frame returned by
covidcast_signal(). (Only the latest issue from the
data frame is used for plotting.) See
vignette("plotting-signals", package = "covidcast") for examples.
# S3 method for covidcast_signal plot( x, plot_type = c("choro", "bubble", "line"), time_value = NULL, include = c(), range = NULL, choro_col = c("#FFFFCC", "#FD893C", "#800026"), alpha = 0.5, bubble_col = "purple", num_bins = 8, title = NULL, choro_params = list(), bubble_params = list(), line_params = list(), ... )
One of "choro", "bubble", "line" indicating whether to plot a choropleth map, bubble map, or line (time series) graph, respectively. The default is "choro".
Date object (or string in the form "YYYY-MM-DD") specifying
the day to map, for choropleth and bubble maps. If
Vector of state abbreviations (case insensitive, so "pa" and
"PA" both denote Pennsylvania) indicating which states to include in the
choropleth and bubble maps. Default is
Vector of two values: min and max, in this order, to use when
defining the color scale for choropleth maps and the size scale for bubble
maps, or the range of the y-axis for the time series plot. If
Vector of colors, as specified in hex code, to use for the choropleth color scale. Can be arbitrary in length. Default is similar to that from https://delphi.cmu.edu/covidcast/.
Number between 0 and 1, indicating the transparency level to be used in the maps. For choropleth maps, this determines the transparency level for the mega counties. For bubble maps, this determines the transparency level for the bubbles. Default is 0.5.
Bubble color for the bubble map. Default is "purple".
Number of bins for determining the bubble sizes for the
bubble map (here and throughout, to be precise, by bubble size we mean
bubble area). Default is 8. These bins are evenly-spaced in between the min
and max as specified through the
Title for the plot. If
|choro_params, bubble_params, line_params||
Additional parameter lists for the different plot types, for further customization. See details below.
Additional arguments, for compatibility with
ggplot object that can be customized and styled using standard
The following named arguments are supported through the lists
For both choropleth and bubble maps:
Subtitle for the map.
Color assigned to missing or NA geo locations.
Border color for geo locations.
Border size for geo locations.
Position for legend; use "none" to hide legend.
Height and width of the legend.
Breaks for a custom (discrete) color or size scale. Note
that we must set
breaks to be a vector of the same length as
for choropleth maps. This works as follows: we assign the
ith color for
choropleth maps, or the
ith size for bubble maps, if and only if the
given value satisfies
breaks[i] <= value < breaks[i+1], where we take by
breaks = -Inf and
breaks[N+1] = Inf for
N = length(breaks).
Number of decimal places to show for the legend labels.
For choropleth maps only:
Number of values to label on the legend color bar. Ignored
for discrete color scales (when
breaks is set manually).
For bubble maps only:
Should zeros be excluded from the size scale (hence effectively drawn as bubbles of zero size)?
Min size for the size scale.
For line graphs:
Labels for the x-axis and y-axis.
Should standard error bands be drawn?
Transparency level for the standard error bands.