View source: R/plotIndicatorTimeSeries.r View source: R/plotIndicatorTimeSeries.R
plotIndicatorTimeSeries | R Documentation |
This function is for standardized plotitng of indicator time series, such as those found in NOAA's Ecosystem Status Reports. The function imports a data frame of indicator values and dates and plots the time series, denoting mean and values above and below one standard deviation from the mean. An optional trend analysis highlights changes in the mean and slope of the time series in the last 5 years of data (or other specified window).
plotIndicatorTimeSeries(
indobject,
coltoplot = 1,
plotrownum = 1,
plotcolnum = 1,
sublabel = F,
sameYscale = F,
yposadj = 1,
widadj = 1,
hgtadj = 1,
type = "default",
CItype = "band",
trendAnalysis = T,
tWindow = 5,
propNAallow = 0.6,
shading = T,
shadeCol = "redgreen",
anom = "none",
dateformat = "%b%Y",
outname = NA,
outtype = "",
...
)
indobject |
an object of class |
coltoplot |
an integer or integer list defining the column numbers of indicator file to plot. Defaults to a single column of data in column 1. |
plotrownum |
an integer defining the number of rows of plots in a multi-panel plot. |
plotcolnum |
an integer defining the number of columns of plots in multi-panel plot. |
sublabel |
a logical value indicating whether optional descriptive information should appear within main label. |
sameYscale |
a logical value indicating whether a consistent y-axis scale is desired across multiple panels. |
yposadj |
a number specifying manual adjustment of position of y-axis label; values > 1 move text further from the axis. |
widadj |
expansion factor to adjust the total width of plot. |
hgtadj |
expansion factor to adjust the total height of plot. |
type |
a character string indicating which type of plot is desired. Defaults to points, with lines for consecutive time steps only.
|
CItype |
is a character string indictating which type of confidence intervals are desired.
Defaults to shaded bands filling in the area between the upper and lower intervals, or use |
trendAnalysis |
a logical value indicating whether to highlight the trend in mean and slope over last 5 years; defaults to TRUE unless fewer than 5 years of data. |
tWindow |
an integer defining the number of years over which the recent trend analysis should be calculated; defaults to last 5 years. |
propNAallow |
if fraction denoting the allowable proportion of missing values in last 5 years; when the proportion of NAs exceeds this value, trend analysis will not appear (defaults to 0.5) |
shading |
a logical value indicating whether to remove red/green shading of anomalies from plot. |
shadeCol |
a character string indicating whether to use standard red/green shading. Alternate option is |
anom |
a character string indicating whether to convert indicator to monthly anomalies. One of |
dateformat |
a format as defined in strptime which is used for monthly time steps only. Can be full date or month/year combination only. |
outname |
a character string specifying alternate output filename; defaults to using the object name. |
outtype |
a character string specifying format for output, if manual saving is not desired. Options are |
... |
Arguments to be passed to methods such as specifications for plot or axis, particularly |
A deprecated version of this code allowed for .csv format to be input. These can now be converted using conv2indicatordata.
Data must be input as a list object of class indicatordata
which contains at least three attributes: labels
, indicators
, and datelist
.
labels
is a data.frame containing up to 3 rows and the number of columns equal to the number of indicators.
Row 1 specifies the indicator name, row 2 specifies the measurement unit, and row 3 specifies a sublabel.
indicators
is a data.frame containing the indicator data, with each column containing values for a given indicator and time step.
datelist
is a vector containing the time steps at which the indicators were measured, in chronological order.
The length of datelist
must be equal to the number of rows in indicators
.
Time can be in year (with century), or monthly time step in a variety of formats (e.g, Jan1986, Jan-86, 1986jan), including or excluding day of month.
Optional attributes: ulim
and llim
are represent, respectively, the upper and lower confidence intervals.
They must be in the format of a data.frame, with equal dimensions to indicators
. The first column of ulim
corresponds to the first column of indicators
, and so on.
https://www.aoml.noaa.gov/ocd/ocdweb/ESR_GOMIEA/report/GoM_EcosystemStatusReport2017.pdf
## plot a single indicator
head(menhaden)
plotIndicatorTimeSeries(menhaden)
## plot a four-panel plot of indicator values reported at different locations
plotIndicatorTimeSeries(bottomDO, coltoplot = 1:4, sublabel = T, sameYscale = T)
## plot an indicator, compare with plot of standardized anomalies
par(mfrow = c(2, 1))
plotIndicatorTimeSeries(NPP)
plotIndicatorTimeSeries(NPP, anom = "stmon")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.