Description Usage Arguments Details Value References Examples
View source: R/generateaWhereChart.R
generateaWhereChart
Generate a plot using aWhere weather
data with standardized formatting.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | generateaWhereChart(
data,
variable,
variable_rightAxis = NULL,
day_start = NULL,
day_end = NULL,
title = NULL,
e_precip = FALSE,
e_threshold = 35,
doRoll = FALSE,
rolling_window = 30,
includeSTD = FALSE,
mainGraphType = "line",
daysToAggregateOver = NULL,
yAxisLimits = NA,
size_font_main_title = 16,
size_font_axis_titles = 14,
size_font_axis_labels = 12,
size_font_legend_entries = 12,
line_width = 1,
annotationsWhichSide = "left"
)
|
data |
data frame in which variables are named according to the schema output by generateaWhereDataset.R (required) |
variable |
character string denoting the variable to chart. Acceptable values are accumulatedGdd, accumulatedPet, accumulatedPpet, accumulatedPrecipitation, gdd, pet, precipitation, maxRH, minRH, solar,averageWind,dayMaxWind, rollingavgppet. (required) |
variable_rightAxis |
What variable to plot over the primary variable. The right y-axis of the plot will be used to present its range. Note that it will always be plotted as a line chart. Same valid values as the variable param. (optional) |
day_start |
Specify the start date of the daily data you want plotted in the figure (optional) |
day_end |
Specify the end date of the daily data you want plotted in the figure (optional) |
title |
character string of title to assign to the plot. (required) |
e_precip |
logical, if set to TRUE, effective precipitation will be calculated and charted based on e_threshold. Default is set to FALSE. (optional) |
e_threshold |
numeric value (in milimeters) for the daily maximum used to calculate effective precipitation if e_precip is set to TRUE. (optional) |
doRoll |
apply a rolling average to the calculation. |
rolling_window |
numeric value for the number of days to use in rolling average calculations. Default value is 30. (optional) |
includeSTD |
whether to plot the standard deviation as a ribbon around the LTN value of the main variable. (optional) |
daysToAggregateOver |
Used to temporally aggregate data. Unit is in days. This is done based on the startdate of the dataset, not a calendar week (otpional) |
yAxisLimits |
Used to set the limits of the y axis explicitly. If used, must be a two element vector of the form c(minValue, maxValue) (optional) |
size_font_main_title |
Font size of main title of graph (optional) |
size_font_axis_titles |
Font size of axes on graph (optional) |
size_font_axis_labels |
Font size of labels on axes on graph (optional) |
size_font_legend_entries |
Font size of entries in lengend on graph (optional) |
line_width |
Font size for line geometries on charts (optional) |
maingraphType |
Which type of graph to make for the main plot. Valid values are "line" and "bar" (optional) |
This function makes basic line plots using data returned from the aWhereAPI and formatted using the generateaWhereDataset function. The function requires variables to be named according to the conventions of that function, or the basic functions of the aWhereAPI package. Users must pass the dataset object to the function as well as one of the acceptable list of variables to chart. Users may also use the optional parameters to customize a plot title, turn on the "effective precipitation" option, or customize the rolling window. The returned plot will be a line chart comparing the actual conditions within the dataset's datespan (labeled Current in the plot) to the long-term normals for that same datespan.
If users turn on effective precipitation (e_precip = TRUE), the function will add a line to the plot in which all daily precipitation values (the Current line) are capped at the maximum allowable amount (defined by the parameter e_threshold). This serves as a proxy for runoff in times of high volumes of rain. The default value of e_threshold is 35 mm.
The standard plot formatting is generated using ggplot2's gray theme.
plot object
http://developer.awhere.com/api/reference/
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.