ggspectra

R package 'ggspectra' (from r4photobiology suite)

https://github.com/aphalo/ggspectra

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 9 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.2%) to scientific vocabulary

Keywords

dataviz ggplot2-autoplot ggplot2-enhancementes ggplot2-geoms ggplot2-scales ggplot2-stats light r4photobiology-suite radiation spectra
Last synced: 6 months ago · JSON representation ·

Repository

R package 'ggspectra' (from r4photobiology suite)

Basic Info
Statistics
  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • Open Issues: 10
  • Releases: 0
Topics
dataviz ggplot2-autoplot ggplot2-enhancementes ggplot2-geoms ggplot2-scales ggplot2-stats light r4photobiology-suite radiation spectra
Created about 5 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog Citation

README.Rmd

---
output: github_document
---



```{r, echo = FALSE}
knitr::opts_chunk$set(
  fig.asp = 2/3,
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)
```

# ggspectra 
## Extensions to 'ggplot2' for Radiation Spectra

[![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 page [The R for Photobiology Suite](https://www.r4photobiology.info/pages/r4p-introduction.html) for an overview of the component packages.

## Examples

Plotting spectra with an specialization of the `autoplot()` method provides the most automatic approach. The specializations provided support the classes defined in package 'photobiology', both for individual spectra and for collections of spectra.

```{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. Although designed with the classes defined from package 'photobiology' in mind, geometries, statistics and scales can also be used with data stored in other formats, as long as the user pays attention to the expected units and bases of expression expected.

```{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-2025 Pedro J. Aphalo (pedro.aphalo@helsinki.fi). Released under the GPL, version 2 or greater. This software carries no warranty of any kind.


Owner

  • Name: Pedro Aphalo
  • Login: aphalo
  • Kind: user
  • Location: Helsinki, Finland
  • Company: University of Helsinki, Organismal and Evolutionary Biology (OEB)

Senior University Lecturer, Principal Investigator (Sensory Ecology of Plants, Photobiology, Crops, Forest trees, Data Analysis, Data Visualization)

Citation (CITATION.cff)

# -----------------------------------------------------------
# CITATION file created with {cffr} R package, v0.2.2
# See also: https://docs.ropensci.org/cffr/
# -----------------------------------------------------------
 
cff-version: 1.2.0
message: 'To cite package "ggspectra" in publications use:'
type: software
license: GPL-2.0-or-later
title: 'ggspectra: Extensions to ''ggplot2'' for Radiation Spectra'
version: 0.3.8-1
doi: 10.19232/uv4pb.2015.1.14
abstract: Additional annotations, stats, geoms and scales for plotting "light" spectra
  with 'ggplot2', together with specializations of ggplot() and autoplot() methods
  for spectral data and waveband definitions stored in objects of classes defined
  in package 'photobiology'. Part of the 'r4photobiology' suite, Aphalo P. J. (2015)
  <doi:10.19232/uv4pb.2015.1.14>.
authors:
- family-names: Aphalo
  given-names: Pedro J.
  email: pedro.aphalo@helsinki.fi
  orcid: https://orcid.org/0000-0003-3385-972X
preferred-citation:
  type: article
  title: The r4photobiology suite
  authors:
  - family-names: Aphalo
    given-names: Pedro J.
    email: pedro.aphalo@helsinki.fi
    orcid: https://orcid.org/0000-0003-3385-972X
  journal: UV4Plants Bulletin
  volume: '2015'
  issue: '1'
  year: '2015'
  doi: 10.19232/uv4pb.2015.1.14
  start: 21-29
repository: https://CRAN.R-project.org/package=ggspectra
repository-code: https://github.com/aphalo/ggspectra/issues/
url: https://docs.r4photobiology.info/ggspectra/
date-released: '2022-08-13'
contact:
- family-names: Aphalo
  given-names: Pedro J.
  email: pedro.aphalo@helsinki.fi
  orcid: https://orcid.org/0000-0003-3385-972X
references:
- type: software
  title: 'R: A Language and Environment for Statistical Computing'
  notes: Depends
  authors:
  - name: R Core Team
  location:
    name: Vienna, Austria
  year: '2022'
  url: https://www.R-project.org/
  institution:
    name: R Foundation for Statistical Computing
  version: '>= 3.6.0'
- type: software
  title: photobiology
  abstract: 'photobiology: Photobiological Calculations'
  notes: Depends
  authors:
  - family-names: Aphalo
    given-names: Pedro J.
    email: pedro.aphalo@helsinki.fi
    orcid: https://orcid.org/0000-0003-3385-972X
  year: '2022'
  url: https://CRAN.R-project.org/package=photobiology
  version: '>= 0.10.10'
- type: software
  title: ggplot2
  abstract: 'ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics'
  notes: Depends
  authors:
  - family-names: Wickham
    given-names: Hadley
    email: hadley@rstudio.com
    orcid: https://orcid.org/0000-0003-4757-117X
  - family-names: Chang
    given-names: Winston
    orcid: https://orcid.org/0000-0002-1576-2126
  - family-names: Henry
    given-names: Lionel
  - family-names: Pedersen
    given-names: Thomas Lin
    email: thomas.pedersen@rstudio.com
    orcid: https://orcid.org/0000-0002-5147-4711
  - family-names: Takahashi
    given-names: Kohske
  - family-names: Wilke
    given-names: Claus
    orcid: https://orcid.org/0000-0002-7470-9261
  - family-names: Woo
    given-names: Kara
    orcid: https://orcid.org/0000-0002-5125-4188
  - family-names: Yutani
    given-names: Hiroaki
    orcid: https://orcid.org/0000-0002-3385-7233
  - family-names: Dunnington
    given-names: Dewey
    orcid: https://orcid.org/0000-0002-9415-4582
  year: '2022'
  url: https://CRAN.R-project.org/package=ggplot2
  version: '>= 3.3.4'
- type: software
  title: photobiologyWavebands
  abstract: 'photobiologyWavebands: Waveband Definitions for UV, VIS, and IR Radiation'
  notes: Imports
  authors:
  - family-names: Aphalo
    given-names: Pedro J.
    email: pedro.aphalo@helsinki.fi
    orcid: https://orcid.org/0000-0003-3385-972X
  year: '2022'
  url: https://CRAN.R-project.org/package=photobiologyWavebands
  version: '>= 0.4.3'
- type: software
  title: scales
  abstract: 'scales: Scale Functions for Visualization'
  notes: Imports
  authors:
  - family-names: Wickham
    given-names: Hadley
    email: hadley@rstudio.com
  - family-names: Seidel
    given-names: Dana
  year: '2022'
  url: https://CRAN.R-project.org/package=scales
  version: '>= 1.2.0'
- type: software
  title: ggrepel
  abstract: 'ggrepel: Automatically Position Non-Overlapping Text Labels with ''ggplot2'''
  notes: Imports
  authors:
  - family-names: Slowikowski
    given-names: Kamil
    email: kslowikowski@gmail.com
    orcid: https://orcid.org/0000-0002-2843-6370
  year: '2022'
  url: https://CRAN.R-project.org/package=ggrepel
  version: '>= 0.9.1'
- type: software
  title: lubridate
  abstract: 'lubridate: Make Dealing with Dates a Little Easier'
  notes: Imports
  authors:
  - family-names: Spinu
    given-names: Vitalie
    email: spinuvit@gmail.com
  - family-names: Grolemund
    given-names: Garrett
  - family-names: Wickham
    given-names: Hadley
  year: '2022'
  url: https://CRAN.R-project.org/package=lubridate
  version: '>= 1.8.0'
- type: software
  title: tidyr
  abstract: 'tidyr: Tidy Messy Data'
  notes: Imports
  authors:
  - family-names: Wickham
    given-names: Hadley
    email: hadley@rstudio.com
  - family-names: Girlich
    given-names: Maximilian
  year: '2022'
  url: https://CRAN.R-project.org/package=tidyr
  version: '>= 1.2.0'
- type: software
  title: tidyselect
  abstract: 'tidyselect: Select from a Set of Strings'
  notes: Imports
  authors:
  - family-names: Henry
    given-names: Lionel
    email: lionel@rstudio.com
  - family-names: Wickham
    given-names: Hadley
    email: hadley@rstudio.com
  year: '2022'
  url: https://CRAN.R-project.org/package=tidyselect
  version: '>= 1.1.2'
- type: software
  title: tibble
  abstract: 'tibble: Simple Data Frames'
  notes: Imports
  authors:
  - family-names: Müller
    given-names: Kirill
    email: krlmlr+r@mailbox.org
  - family-names: Wickham
    given-names: Hadley
    email: hadley@rstudio.com
  year: '2022'
  url: https://CRAN.R-project.org/package=tibble
  version: '>= 3.1.5'
- type: software
  title: knitr
  abstract: 'knitr: A General-Purpose Package for Dynamic Report Generation in R'
  notes: Suggests
  authors:
  - family-names: Xie
    given-names: Yihui
    email: xie@yihui.name
    orcid: https://orcid.org/0000-0003-0645-5666
  year: '2022'
  url: https://CRAN.R-project.org/package=knitr
  version: '>= 1.38'
- type: software
  title: rmarkdown
  abstract: 'rmarkdown: Dynamic Documents for R'
  notes: Suggests
  authors:
  - family-names: Allaire
    given-names: JJ
    email: jj@rstudio.com
  - family-names: Xie
    given-names: Yihui
    email: xie@yihui.name
    orcid: https://orcid.org/0000-0003-0645-5666
  - family-names: McPherson
    given-names: Jonathan
    email: jonathan@rstudio.com
  - family-names: Luraschi
    given-names: Javier
    email: javier@rstudio.com
  - family-names: Ushey
    given-names: Kevin
    email: kevin@rstudio.com
  - family-names: Atkins
    given-names: Aron
    email: aron@rstudio.com
  - family-names: Wickham
    given-names: Hadley
    email: hadley@rstudio.com
  - family-names: Cheng
    given-names: Joe
    email: joe@rstudio.com
  - family-names: Chang
    given-names: Winston
    email: winston@rstudio.com
  - family-names: Iannone
    given-names: Richard
    email: rich@rstudio.com
    orcid: https://orcid.org/0000-0003-3925-190X
  year: '2022'
  url: https://CRAN.R-project.org/package=rmarkdown
  version: '>= 2.13'
- type: software
  title: rlang
  abstract: 'rlang: Functions for Base Types and Core R and ''Tidyverse'' Features'
  notes: Suggests
  authors:
  - family-names: Henry
    given-names: Lionel
    email: lionel@rstudio.com
  - family-names: Wickham
    given-names: Hadley
    email: hadley@rstudio.com
  year: '2022'
  url: https://CRAN.R-project.org/package=rlang
  version: '>= 1.0.2'
- type: software
  title: magrittr
  abstract: 'magrittr: A Forward-Pipe Operator for R'
  notes: Suggests
  authors:
  - family-names: Bache
    given-names: Stefan Milton
    email: stefan@stefanbache.dk
  - family-names: Wickham
    given-names: Hadley
    email: hadley@rstudio.com
  year: '2022'
  url: https://CRAN.R-project.org/package=magrittr
  version: '>= 2.0.3'
identifiers:
- type: url
  value: https://github.com/aphalo/ggspectra/

GitHub Events

Total
  • Issues event: 12
  • Delete event: 1
  • Issue comment event: 12
  • Push event: 43
  • Create event: 4
Last Year
  • Issues event: 12
  • Delete event: 1
  • Issue comment event: 12
  • Push event: 43
  • Create event: 4

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 364
  • Total Committers: 2
  • Avg Commits per committer: 182.0
  • Development Distribution Score (DDS): 0.014
Past Year
  • Commits: 24
  • Committers: 1
  • Avg Commits per committer: 24.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Pedro J. Aphalo p****o@h****i 359
aphalo a****o 5
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 22
  • Total pull requests: 1
  • Average time to close issues: 4 months
  • Average time to close pull requests: 36 minutes
  • Total issue authors: 3
  • Total pull request authors: 1
  • Average comments per issue: 1.77
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 10
  • Pull requests: 0
  • Average time to close issues: about 1 month
  • Average time to close pull requests: N/A
  • Issue authors: 2
  • Pull request authors: 0
  • Average comments per issue: 1.4
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • aphalo (20)
  • nist-zack (1)
  • DeLaRiva (1)
Pull Request Authors
  • aphalo (2)
Top Labels
Issue Labels
enhancement (16) bug (5) on hold (1) documentation (1) question (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 560 last-month
  • Total dependent packages: 7
  • Total dependent repositories: 5
  • Total versions: 28
  • Total maintainers: 1
cran.r-project.org: ggspectra

Extensions to 'ggplot2' for Radiation Spectra

  • Versions: 28
  • Dependent Packages: 7
  • Dependent Repositories: 5
  • Downloads: 560 Last month
Rankings
Dependent packages count: 6.6%
Dependent repos count: 13.0%
Average: 17.6%
Downloads: 18.8%
Stargazers count: 21.9%
Forks count: 27.8%
Maintainers (1)
Last synced: 7 months ago

Dependencies

DESCRIPTION cran
  • R >= 4.1.0 depends
  • ggplot2 >= 3.3.4 depends
  • photobiology > 0.10.14 depends
  • ggrepel >= 0.9.1 imports
  • lubridate >= 1.8.0 imports
  • photobiologyWavebands >= 0.4.3 imports
  • rlang >= 1.0.2 imports
  • scales >= 1.2.0 imports
  • tibble >= 3.1.5 imports
  • knitr >= 1.38 suggests
  • magrittr >= 2.0.3 suggests
  • rmarkdown >= 2.13 suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite