-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
101 lines (67 loc) · 4.66 KB
/
README.Rmd
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
fig.asp = 2/3,
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
# ggspectra <img src="man/figures/logo.png" align="right" width="120" />
[![cran version](https://www.r-pkg.org/badges/version-last-release/ggspectra)](https://cran.r-project.org/package=ggspectra)
[![cran checks](https://badges.cranchecks.info/worst/ggspectra.svg)](https://cran.r-project.org/web/checks/check_results_ggspectra.html)
[![photobiology status badge](https://aphalo.r-universe.dev/badges/ggspectra)](https://aphalo.r-universe.dev/ggspectra)
[![R-CMD-check](https://github.com/aphalo/ggspectra/workflows/R-CMD-check/badge.svg)](https://github.com/aphalo/ggspectra/actions)
[![Documentation](https://img.shields.io/badge/documentation-ggspectra-informational.svg)](https://docs.r4photobiology.info/ggspectra/)
[![doi](https://img.shields.io/badge/doi-10.32614/CRAN.package.ggspectra-blue.svg)](https://doi.org/10.32614/CRAN.package.ggspectra)
The goal of 'ggspectra' is to make it easy to plot radiation spectra and similar data, such and transmittance, absorbance and reflectance spectra, producing fully annotated publication- and presentation-ready plots. It is an extension to packages 'ggplot2' and 'photobiology', and part of the 'r4photobiology' suite.
Package 'ggspectra' provides stats, geoms, scales and functions to be used for plotting radiation-related spectra and annotating the plots with quantities derived from spectral data. All summary quantities implemented in 'photobiology' can be used for annotations including biologically effective irradiances and exposures.
Please, see the web site [r4photobiology](https://www.r4photobiology.info) for details on other packages available as part of the suite, and on how to install them.
## Examples
Plotting spectra with an specialization of the `autoplot()` method provides the most automatic approach.
```{r example0, message=FALSE}
library(ggspectra)
autoplot(sun.spct)
```
Some degree of flexibility can be obtained by passing arguments.
```{r example1}
autoplot(sun.spct, annotations = c("+", "title:where:when"), unit.out = "photon")
```
Maximum flexibility is achieved when building a plot layer by layer using the grammar of graphics approach, as implemented in 'ggplot2', but taking advantage of the specialized `ggplot()` methods, _geometries_, _statistics_ and _scales_ specialized for the plotting of spectra, defined in this package .
```{r example2, message=FALSE}
ggplot(sun.spct, unit.out = "photon") +
geom_spct() +
scale_y_s.q.irrad_continuous() +
scale_x_wl_continuous(sec.axis = sec_axis_w_number()) +
theme_bw()
```
## Installation
Installation of the most recent stable version from CRAN:
```{r cran-instalaltion, eval=FALSE}
install.packages("ggspectra")
```
Installation of the current unstable version from GitHub:
```{r bb-instalaltion, eval=FALSE}
# install.packages("remotes")
remotes::install_github("aphalo/ggspectra")
```
## Documentation
HTML documentation is available at (https://docs.r4photobiology.info/ggspectra/), including additional on-line-only articles.
News on updates to the different packages of the 'r4photobiology' suite are regularly posted at (https://www.r4photobiology.info/).
Two articles introduce the basic ideas behind the design of the suite and its use:
Aphalo P. J. (2015) (https://doi.org/10.19232/uv4pb.2015.1.14) and Aphalo P. J. (2016) (https://doi.org/10.19232/uv4pb.2016.1.15).
A book is under preparation, and the draft is currently available at (https://leanpub.com/r4photobiology/). The book contains many examples of plots created with 'ggspectra'.
A handbook written before the suite was developed contains useful information on the quantification and manipulation of ultraviolet and visible radiation:
Aphalo, P. J., Albert, A., Björn, L. O., McLeod, A. R., Robson, T. M., & Rosenqvist, E. (Eds.) (2012) Beyond the Visible: A handbook of best practice in plant UV photobiology (1st ed., p. xxx + 174). Helsinki: University of Helsinki, Department of Biosciences, Division of Plant Biology. ISBN 978-952-10-8363-1 (PDF), 978-952-10-8362-4 (paperback). PDF file available from (https://doi.org/10.31885/9789521083631).
## Contributing
Pull requests, bug reports, and feature requests are welcome at (https://github.com/aphalo/ggspectra).
## Citation
If you use this package to produce scientific or commercial publications, please cite according to:
```{r}
citation("ggspectra")
```
## License
© 2015-2024 Pedro J. Aphalo ([email protected]). Released under the GPL, version 2 or greater. This software carries no warranty of any kind.