Skip to contents

Create a plot of the crop progress data.

Usage

# S4 method for Progress,ANY
plot(
  x,
  region = NULL,
  season = NULL,
  crops = NULL,
  ncol = NULL,
  nrow = NULL,
  ylab = "Percentage",
  xlab = "Time",
  save = FALSE,
  path = get_path_hermes(),
  file = "plot.pdf",
  width = 15,
  height = 8
)

Arguments

x

an object of class Progress.

region

Region. The region corresponding to the data.

season

numeric. Year(s) of interest.

crops

character. The crops of interest.

ncol

numeric. Number of rows in the plot layout.

nrow

numeric. Number of columns in the plot layout.

ylab

character. The y-axis title.

xlab

character. The x-axis title.

save

logical. Should the plot be saved?

path

character. The directory in which the plot will be saved.

file

character. The file name.

width

numeric. The width of the plot in inches.

height

numeric. The height of the plot in inches.

Value

A plot, created with ggplot2.

Examples

if (FALSE) {
# Define required variables
region <- Region(name = "nebraska", type = "us state",
                 div = c(country = "United States", state = "Nebraska"))
date <- date_seq("2002-01-01", "2002-12-31")

# Create the object
x <- new("Quickstats", region = region, date = date)

# Download the data
data <- download(x, "progress", ringname)
class(data)
class(data[["Corn"]])
head(data$Corn)

# Plot the data
plot(data, crops = "Winter Wheat", year = 2021)
}