Skip to contents

This function is for quickly plotting a single geofield. For geofields in harp_grid_df data frames or harp_lists, extra arguments are available for extracting the correct geofield.

Usage

plot_field(
  .fcst,
  palette = viridisLite::viridis(255),
  num_breaks = 15,
  breaks = NULL,
  legend = TRUE,
  title = "auto",
  zoom_centre = NULL,
  zoom_length = 100,
  ...
)

# S3 method for harp_grid_df
plot_field(
  .fcst,
  palette = viridisLite::viridis(255),
  num_breaks = 15,
  breaks = NULL,
  legend = TRUE,
  title = "auto",
  zoom_centre = NULL,
  zoom_length = 100,
  fcst_dttm,
  lead_time,
  filter_by = NULL,
  plot_col = NULL,
  ...
)

# S3 method for harp_list
plot_field(
  .fcst,
  palette = viridisLite::viridis(255),
  num_breaks = 15,
  breaks = NULL,
  legend = TRUE,
  title = "auto",
  zoom_centre = NULL,
  zoom_length = 100,
  fcst_model = NULL,
  fcst_dttm,
  lead_time,
  filter_by = NULL,
  plot_col = NULL,
  ...
)

# S3 method for geofield
plot_field(
  .fcst,
  palette = viridisLite::viridis(255),
  num_breaks = 15,
  breaks = NULL,
  legend = TRUE,
  title = "auto",
  zoom_centre = NULL,
  zoom_length = 100,
  ...
)

Arguments

.fcst

A geofield, harp_list or harp_grid_df data frame.

palette

Colour palette to use. This should be a vector of colours.

num_breaks

Number of colour breaks to use in the plot.

breaks

The values to use for colour breaks. If not NULL, breaks has priority over num_breaks.

legend

Logical. Whether to plot a legend.

title

The title of the plot. Set to "auto" to automatically generate a title.

zoom_centre

The centre point for a zoomed plot. Should be a 2-element vector with the longitude and latitude of the desired centre point.

zoom_length

A 2 element vector given the x and y lengths in number of grid squares of the zoomed plot.

fcst_dttm

The forecast date to plot in "YYYYMMDDhh" or similar format. Can be omitted if there is only one date in the data.

lead_time

The lead time to plot. Can be omitted if there is only one lead time in the data.

filter_by

Expressions that return a logical value wrapped inside the vars function for filtering the data prior to plotting. Only a single row should be left in the data frame for plot_field to work.

plot_col

The column in the data frame to take data from to plot

fcst_model

The fcst_model in a harp_list to plot from.

Value

A plot