Learn R Programming

clifro (version 3.2-5)

plot,cfRain,missing-method: Plot Rain Time series

Description

Plot the amount of rainfall (mm) through time, with optional available soil water capacity and runoff amounts (if applicable).

Usage

# S4 method for cfRain,missing
plot(
  x,
  y,
  include_runoff = TRUE,
  ggtheme = c("grey", "gray", "bw", "linedraw", "light", "minimal", "classic"),
  scales = c("fixed", "free_x", "free_y", "free"),
  n_col = 1,
  ...
)

Arguments

x

a cfRain object.

y

missing.

include_runoff

a logical indicating whether to plot the soil moisture deficit and runoff as well as the rainfall, if the data is available (default TRUE).

ggtheme

character string (partially) matching the ggtheme to be used for plotting, see 'Theme Selection' below.

scales

character string partially matching the scales argument in the link[ggplot2]{facet_wrap} function.

n_col

the number of columns of plots (default 1).

...

further arguments passed to theme.

Details

When there is a rain event, the amount of runoff, if any, is dependent on how much capacity the soil has available for more water. If there is no available water capacity left in the soil then more rain will lead to a runoff event. If include_runoff = TRUE, the available water capacity is plotted as negative values and the runoff as positive values to signify this negative relationship.

See Also

plot,cfDataList,missing-method for general information on default plotting of cfData and cfDataList objects, and the links within. See cf_query for creating cfRain objects.

Refer to theme for more possible arguments to pass to these methods.

Examples

Run this code
# NOT RUN {
# Retrieve public rain data for a month from CliFlo (at Reefton Ews station)
reefton_rain = cf_query(cf_user(), cf_datatype(3, 1, 1), cf_station(),
                        start_date = "2012-08-01-00",
                        end_date = "2012-09-01-00")

class(reefton_rain) # cfRain object

# Plot the rain data using the defaults
plot(reefton_rain)

# Change the ggtheme and enlarge the text
library(ggplot2) # for element_text()
plot(reefton_rain, ggtheme = "bw", text = element_text(size = 16))

# Save the plot as a png to the current working directory
library(ggplot2) # for ggsave()
ggsave("my_rain_plot.png")
# }

Run the code above in your browser using DataLab