geom_maskarea: Mask all area outside of saturation line

Description Usage Arguments Details Aesthetics Examples

Description

geom_maskarea() draws a polygon to mask all area outside of the saturation line. The vertices of polygon are based on current psychrometric chart's dry-bulb temperature (x axis) range and humidity ratio (y axis) range.

Usage

1
2
3
4
5
6
7
8
9
geom_maskarea(
  mapping = NULL,
  data = NULL,
  units = waiver(),
  pres = waiver(),
  n = 201,
  ...,
  na.rm = FALSE
)

Arguments

mapping

Set of aesthetic mappings created by aes() or aes_(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

data

The data to be displayed in this layer. There are three options:

If NULL, the default, the data is inherited from the plot data as specified in the call to ggplot().

A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See fortify() for which variables will be created.

A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).

units

A single string indicating the units sytem to use. Should be either "SI" or "IP" or waiver()which uses the value from the parent plot. Default:waiver()'.

pres

A single number indicating the atmosphere pressure in Pa [SI] or Psi [IP]. If waiver(), the pressure calculated from the parent plot's altitude value will be used. Default: waiver().

n

Number of points to interpolate along

...

Other arguments passed on to layer(). These are often aesthetics, used to set an aesthetic to a fixed value, like colour = "red" or size = 3. They may also be parameters to the paired geom/stat.

na.rm

If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.

Details

geom_maskarea() is based on ggplot2::geom_polygon(), so you can further customize the area style in the same way.

Normally there is no need to add another mask since ggpsychro() calls geom_maskarea() internally and makes sure that it is always rendered after other layers.

Aesthetics

geom_maskarea() understands the following aesthetics (required aesthetics are in bold).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# by default, a mask is automatically added when calling 'ggpsychro()' function
ggpsychro()

# replace with another mask area for pressure at 102000
ggpsychro() +
    geom_maskarea(units = "SI", pres = 102000)

# the line style can be further customized like 'ggplot2::geom_line()'
ggpsychro() +
    geom_maskarea(units = "SI", pres = 101325, color = "blue", fill = "green")

hongyuanjia/ggpsychro documentation built on Feb. 3, 2021, 12:31 p.m.