Plot climate variable (like MAT
, MTCO
, etc.), in addition to
latitude
and longitude
, a column with the value of var
is required.
plot_climate(
.data,
var = "mat",
units = NA,
fill_scale = ggplot2::scale_fill_viridis_d(name = toupper(var)),
size = 1,
stroke = 0.1,
legend.key.width = ggplot2::unit(1, "cm"),
legend.position = "bottom",
xlim = c(-180, 180),
ylim = c(-60, 90),
show_plot = TRUE,
elevation_cut = NULL,
land_borders = rnaturalearth::ne_countries(scale = "small", returnclass = "sf"),
land_borders_colour = "black",
land_borders_size = 0.25,
fill_land = "white",
fill_sea = "#CFE2F3",
contour = FALSE,
...
)
plot_climate_countour(
.data,
var = "mat",
units = NA,
fill_scale = ggplot2::scale_fill_gradientn(name = toupper(var), colours =
wesanderson::wes_palette("Zissou1", 100, type = "continuous")),
size = 1,
stroke = 0.5,
legend.key.width = ggplot2::unit(2, "cm"),
legend.position = "bottom",
xlim = c(-180, 180),
ylim = c(-60, 90),
show_plot = TRUE,
elevation_cut = NULL,
land_borders = rnaturalearth::ne_countries(scale = "small", returnclass = "sf"),
land_borders_colour = "black",
land_borders_size = 0.25,
fill_land = "white",
fill_sea = "#CFE2F3",
resolution = 0.5,
...
)
plot_climate_tiles(
.data,
var = "mat",
units = NA,
fill_scale = ggplot2::scale_fill_manual(name = toupper(var), values =
wesanderson::wes_palette("Zissou1", 9, type = "continuous")),
size = 1,
stroke = 0.1,
legend.key.width = ggplot2::unit(1, "cm"),
legend.position = "bottom",
xlim = c(-180, 180),
ylim = c(-60, 90),
show_plot = TRUE,
elevation_cut = NULL,
land_borders = rnaturalearth::ne_countries(scale = "small", returnclass = "sf"),
land_borders_colour = "black",
land_borders_size = 0.25,
fill_land = "white",
fill_sea = "#CFE2F3",
.overlay_data = NULL,
continuous = FALSE,
...
)
plot_gdd(
.data,
baseline = 0,
size = 1,
stroke = 0.1,
legend.key.width = ggplot2::unit(1, "cm"),
legend.position = "bottom",
xlim = c(-180, 180),
ylim = c(-60, 90),
show_plot = TRUE,
...
)
plot_mat(
.data,
size = 1,
stroke = 0.1,
legend.key.width = ggplot2::unit(1, "cm"),
legend.position = "bottom",
xlim = c(-180, 180),
ylim = c(-60, 90),
show_plot = TRUE,
...
)
plot_mi(
.data,
size = 1,
stroke = 0.1,
legend.key.width = ggplot2::unit(1, "cm"),
legend.position = "bottom",
xlim = c(-180, 180),
ylim = c(-60, 90),
show_plot = TRUE,
...
)
plot_mtco(
.data,
size = 1,
stroke = 0.1,
legend.key.width = ggplot2::unit(1, "cm"),
legend.position = "bottom",
xlim = c(-180, 180),
ylim = c(-60, 90),
show_plot = TRUE,
...
)
plot_mtwa(
.data,
size = 1,
stroke = 0.1,
legend.key.width = ggplot2::unit(1, "cm"),
legend.position = "bottom",
xlim = c(-180, 180),
ylim = c(-60, 90),
show_plot = TRUE,
...
)
Data frame with spatial and climate data. The following are expected:
Latitude, named: latitude
, lat
or y
.
Longitude, named: longitude
, long
, lon
or y
.
Main variable, named: value of var
.
String with the name of the climate variable to plot. Default:
"mat"
(Mean Annual Temperature).
String with the units to display next to the legend tittle.
Default: NA
.
ggplot2
compatible object with information on how to
fill the individual points for the climate variable. Default:
ggplot2::scale_fill_viridis_c(name = toupper(var))
.
Numeric value for the size
aesthetic.
Numeric value for the stroke
aesthetic.
size of legend keys (unit
); key background height & width inherit from
legend.key.size
or can be specified separately
the position of legends ("none", "left", "right", "bottom", "top", or two-element numeric vector)
Limits for the x and y axes. These limits are specified
in the units of the default CRS. By default, this means projected coordinates
(default_crs = NULL
). How limit specifications translate into the exact
region shown on the plot can be confusing when non-linear or rotated coordinate
systems are used as the default crs. First, different methods can be preferable
under different conditions. See parameter lims_method
for details. Second,
specifying limits along only one direction can affect the automatically generated
limits along the other direction. Therefore, it is best to always specify limits
for both x and y. Third, specifying limits via position scales or xlim()
/ylim()
is strongly discouraged, as it can result in data points being dropped from the plot even
though they would be visible in the final plot region.
Limits for the x and y axes. These limits are specified
in the units of the default CRS. By default, this means projected coordinates
(default_crs = NULL
). How limit specifications translate into the exact
region shown on the plot can be confusing when non-linear or rotated coordinate
systems are used as the default crs. First, different methods can be preferable
under different conditions. See parameter lims_method
for details. Second,
specifying limits along only one direction can affect the automatically generated
limits along the other direction. Therefore, it is best to always specify limits
for both x and y. Third, specifying limits via position scales or xlim()
/ylim()
is strongly discouraged, as it can result in data points being dropped from the plot even
though they would be visible in the final plot region.
Boolean flag to indicate whether or not the graphic should
be displayed, if FALSE
, it only returns the ggplot2
object.
Default: TRUE
.
Numeric value to use as the threshold of the elevation at which the sites will be represented with different shapes.
Data frame with polygons to represent land borders
(e.g. continents, countries, counties, etc.).
Default: rnaturalearth::ne_countries
.
String containing a colour code (HEX value) or
colour name, to be used as colour for the land borders.
Default: "black"
.
Numeric value of the line size to draw the land
borders. Default: 0.25
String containing a colour code (HEX value) or colour
name, to be used as filling for the countries.
Default: NA
(transparent).
String containing a colour code (HEX value) or colour
name, to be used as filling for the seas
Default: NA
(transparent).
Boolean flag to indicate if a contour should be overlaid
on the individual sites/points. It uses the function akima::interp()
to interpolate values from the nearest available points.
Arguments passed on to ggplot2::coord_sf
expand
If TRUE
, the default, adds a small expansion factor to
the limits to ensure that data and axes don't overlap. If FALSE
,
limits are taken exactly from the data or xlim
/ylim
.
crs
The coordinate reference system (CRS) into which all data should be projected before plotting. If not specified, will use the CRS defined in the first sf layer of the plot.
default_crs
The default CRS to be used for non-sf layers (which
don't carry any CRS information) and scale limits. The default value of
NULL
means that the setting for crs
is used. This implies that all
non-sf layers and scale limits are assumed to be specified in projected
coordinates. A useful alternative setting is default_crs = sf::st_crs(4326)
,
which means x and y positions are interpreted as longitude and latitude,
respectively, in the World Geodetic System 1984 (WGS84).
datum
CRS that provides datum to use when generating graticules.
label_graticule
Character vector indicating which graticule lines should be labeled
where. Meridians run north-south, and the letters "N"
and "S"
indicate that
they should be labeled on their north or south end points, respectively.
Parallels run east-west, and the letters "E"
and "W"
indicate that they
should be labeled on their east or west end points, respectively. Thus,
label_graticule = "SW"
would label meridians at their south end and parallels at
their west end, whereas label_graticule = "EW"
would label parallels at both
ends and meridians not at all. Because meridians and parallels can in general
intersect with any side of the plot panel, for any choice of label_graticule
labels
are not guaranteed to reside on only one particular side of the plot panel. Also,
label_graticule
can cause labeling artifacts, in particular if a graticule line
coincides with the edge of the plot panel. In such circumstances, label_axes
will
generally yield better results and should be used instead.
This parameter can be used alone or in combination with label_axes
.
label_axes
Character vector or named list of character values
specifying which graticule lines (meridians or parallels) should be labeled on
which side of the plot. Meridians are indicated by "E"
(for East) and
parallels by "N"
(for North). Default is "--EN"
, which specifies
(clockwise from the top) no labels on the top, none on the right, meridians
on the bottom, and parallels on the left. Alternatively, this setting could have been
specified with list(bottom = "E", left = "N")
.
This parameter can be used alone or in combination with label_graticule
.
lims_method
Method specifying how scale limits are converted into
limits on the plot region. Has no effect when default_crs = NULL
.
For a very non-linear CRS (e.g., a perspective centered
around the North pole), the available methods yield widely differing results, and
you may want to try various options. Methods currently implemented include "cross"
(the default), "box"
, "orthogonal"
, and "geometry_bbox"
. For method "cross"
,
limits along one direction (e.g., longitude) are applied at the midpoint of the
other direction (e.g., latitude). This method avoids excessively large limits for
rotated coordinate systems but means that sometimes limits need to be expanded a
little further if extreme data points are to be included in the final plot region.
By contrast, for method "box"
, a box is generated out of the limits along both directions,
and then limits in projected coordinates are chosen such that the entire box is
visible. This method can yield plot regions that are too large. Finally, method
"orthogonal"
applies limits separately along each axis, and method
"geometry_bbox"
ignores all limit information except the bounding boxes of any
objects in the geometry
aesthetic.
ndiscr
Number of segments to use for discretising graticule lines; try increasing this number when graticules look incorrect.
default
Is this the default coordinate system? If FALSE
(the default),
then replacing this coordinate system with another one creates a message alerting
the user that the coordinate system is being replaced. If TRUE
, that warning
is suppressed.
clip
Should drawing be clipped to the extent of the plot panel? A
setting of "on"
(the default) means yes, and a setting of "off"
means no. In most cases, the default of "on"
should not be changed,
as setting clip = "off"
can cause unexpected results. It allows
drawing of data points anywhere on the plot, including in the plot margins. If
limits are set via xlim
and ylim
and some data points fall outside those
limits, then those data points may show up in places such as the axes, the
legend, the plot title, or the plot margins.
Numeric value for the grid resolution.
(Optional) Data frame with original observations, to be
to be overlaid on top of the tiles in .data
.
(Optional) Boolean flag to indicate whether or not to use
a continuous (TRUE
) fill scale. Default: FALSE
.
Numeric value to be used as the baseline for the calculation
of the Growing Degree Days, default: 0
.
ggplot
object with the plot.