‘ggplot2’ extension for making psychrometric charts.
Installation
You can install the development version from GitHub with:
# install.packages("remotes")
remotes::install_github("hongyuanjia/ggpsychro")Example
The creation of a psychrometric chart starts with ggpsychro(). The result is a ggplot object, so grids, stats, geoms, scales, and themes can be added with the same + workflow used by ggplot2.
ggpsychro(tdb_lim = c(0, 50), hum_lim = c(0, 30)) +
psychro_preset("minimal")
State points and process lines can be supplied with dry-bulb temperature plus one psychrometric property, such as relative humidity.
process <- data.frame(
dry_bulb_temperature = c(18, 23, 28, 31),
relative_humidity = c(70, 55, 45, 55)
)
ggpsychro(tdb_lim = c(0, 40), hum_lim = c(0, 25)) +
psychro_preset("minimal") +
geom_psychro_process(
aes(tdb = dry_bulb_temperature, relhum = relative_humidity),
data = process,
colour = "#0f766e", linewidth = 1,
arrow = grid::arrow(length = grid::unit(0.08, "inches"))
) +
stat_psychro_state(
aes(tdb = dry_bulb_temperature, relhum = relative_humidity),
data = process,
colour = "#0f766e", size = 2
)
Contribute
Please note that the ‘ggpsychro’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.