geom_grid: Draw grid lines of constant psychrometric properties

Description Usage Arguments Details Alignment Aesthetics Examples

Description

geom_grid_*() geoms draw grid line of constant psychrometric properties, including relative humidity, wet-bulb temperature, water vapor pressure, specific volume and enthalpy, based on current psychrometric chart's dry-bulb temperature range and humidity ratio range.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
geom_grid_relhum(
  mapping = NULL,
  data = NULL,
  n = 201,
  label_loc = 0.95,
  label_parse = FALSE,
  units = waiver(),
  pres = waiver(),
  ...,
  na.rm = FALSE
)

geom_grid_wetbulb(
  mapping = NULL,
  data = NULL,
  label_loc = 0.1,
  label_parse = TRUE,
  units = waiver(),
  pres = waiver(),
  ...,
  na.rm = FALSE
)

geom_grid_vappres(
  mapping = NULL,
  data = NULL,
  label_loc = 0.5,
  label_parse = FALSE,
  units = waiver(),
  pres = waiver(),
  ...,
  na.rm = FALSE
)

geom_grid_specvol(
  mapping = NULL,
  data = NULL,
  label_loc = 0.95,
  label_parse = TRUE,
  units = waiver(),
  pres = waiver(),
  ...,
  na.rm = FALSE
)

geom_grid_enthalpy(
  mapping = NULL,
  data = NULL,
  label_loc = 0.95,
  label_parse = TRUE,
  units = waiver(),
  pres = waiver(),
  ...,
  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)).

n

Number of points to interpolate along. Only used in geom_grid_relhum().

label_loc

A single number in range (0, 1) indicating label position relative to the line. The default values aim to reduce overlappings among differnent psychrometric property lines, but you can change them if needed:

  • 0.95 for constant relative humidity lines

  • 0.10 for constant wet-bulb temperature lines

  • 0.50 for constant water vapor pressure lines

  • 0.95 for constant specific volume lines

  • 0.95 for constant enthalpy lines

label_parse

If TRUE, the labels will be parsed into expressions and displayed as described in ?plotmath.

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()

...

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

Each geom_grid_*() comes along with a corresponding scale_*() function for customizing scale properties, including breaks, labels and etc.

For each psychrometric properties, the maximum and minimum value is calculated based on the ranges of dry-bulb temperature and humidity ratio in the coordinate system.

Alignment

You can modify text alignment with the vjust and hjust aesthetics. These can either be a number between 0 (right/bottom) and 1 (top/left) or a character ("left", "middle", "right", "bottom", "center", "top"). There are two special alignments: "inward" and "outward". Inward always aligns text towards the center, and outward aligns it away from the center.

Aesthetics

geom_grid_*() understands the following aesthetics.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# add all grid components
ggpsychro() +
    geom_grid_relhum() +
    geom_grid_wetbulb() +
    geom_grid_vappres() +
    geom_grid_specvol() +
    geom_grid_enthalpy()

# custom grid style
ggpsychro() +
    geom_grid_relhum(alpha = 1.0, label.alpha = 1.0, label.size = 6, label.fontface = 2) +
    geom_grid_wetbulb(size = 1.0, color = "black", alpha = 1.0, label_loc = NA) +
    geom_grid_vappres(label.size = 5)

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