Extensions to 'ggplot2' for Radiation Spectra

Additional annotations, and stats for plotting "light" spectra with 'ggplot2', together with specializations of ggplot() and plot() methods for spectral data stored in objects of the classes defined in package 'photobiology' and a plot() method for objects of class "waveband", also defined in package 'photobiology'. Part of the 'r4photobiology' suite, Aphalo P. J. (2015) .

Package 'ggspectra' is a set of stats, geoms and functions to be used together with packages 'ggplot2' and 'photobiology' for plotting radiation-related spectra and annotating the plots with quantities derived from spectral data. Unweighted derived quantities represent summaries of a given range of wavelengths, which can be expressed either in energy or photon based units. Derived biologically effective quantities are used to quantify the effect of radiation on different organisms or processes within organisms. These effects can range from damage to perception of informational light signals. Peaks and valleys present in spectral data can also be annotated. Color-patch charts can also be created based on any R color definitions, including those generated from wavelengths and visual response functions with functions in package 'photobiology'.

This package uses the new functionality added to 'ggplot2' at version 2.2.0 and is not compatible with earlier versions.

Please, see the web site r4photobiology for details on other packages available as part of the suite, and on how to install them.


ggspectra 0.2.3

Track changes in package 'photobiology' 0.9.18.

  • Add plot.calibration_spct()
  • Add ggplot.calibration_spct()

Improve handling of plot titles.

  • Add utility function ggtitle_spct()
  • Update all plot() methods to allow flexible contents in automatic titles including setting of the time zone and format used for displaying time.

ggspectra 0.2.2

Track changes in package 'photobiology' 0.9.16 and 0.9.17. This among other improvements makes it easy to plot spectral absorptance. Expand y scale to expected range in all cases, but do not force these limits in any case when data exceeds them, except for absorbance for which the y scale is not expanded past 6 a.u. Add new annotation "boundaries" to highlight with horizontal line(s) the expected range of the plotted quantity, highlighting the limit(s) exceeded if data fall outside the expected/range. Add previously missing ggplot() method for class object_spct. Revise vignettes.

ggspectra 0.2.1

Track changes in package 'photobiology' 0.9.14. Add continuous scales with defaults suitable for spectral data, with support for automatic axis labels both as R-expressions and as LaTeX mark-up. Add utility functions for SI scale prefixes. Add utility functions for x-axis-labels and secondary x-axis. Add utility functions for y-axis-labels. Update User Guide (add examples of graphical comparison of multiple lists of wavebands).

ggspectra 0.2.0

Improve handling of annotations parameter in plot() methods. Add functions ggcolorchart() and black_or_white(). Add statistics stat_wb_box() and stat_wb_column() with "rect" as default geom and stat_wb_hbar() with "errorbarh" as default geom. Change default geom from "rect" to "text" in all the summary stats for spectra. Update stats with "text" as default geom to use an additional variable BW.color computed by black_or_white() as default mapping for color. As default geoms and color mapping have changed, this update can break existing code. Changes to plot() methods are backwards compatible but default color of some text labels is changed from "white" to "black" to improve readability, and fewer peaks and valleys are highlighted by default. In addition more ticks marks are used on the wavelength axis. Fix minor bugs in handling of color mapping. Update documentation.

ggspectra 0.1.12 (ver 0.1.11 was not submitted to CRAN)

Import ggplot2 in whole as only the most basic use of plot() methods would not require user access to 'ggplot2'. Add stat_label_peaks() and stat_label_valleys() which are designed to fully take advantage of 'geom_text_repel()' and 'geom_label_repel()' as revised in package 'ggrepel' (>= 0.6.3). Change behaviour of plot() methods so that "illegal" values such as negative spectral irradiances or transmittances are plotted by default. Fix several minor bugs affecting plot() methods with certain non-default sets of annotations. Improve documentation and vignettes.

ggspectra 0.1.10

Add code to maintain same stacking order under ggplot2 1.1.0, 2.0.0, 2.1.0, and 2.1.9000 in plot.object_spct().

ggspectra 0.1.9

Add support for na.rm to all plot() methods setting default to TRUE, and avoid triggering spurious warnings from internal code. Make default for parameter 'label.qty' in plot methods dependent on whether data are expressed in absolute units or have been rescaled or normalized. Move from the 'User Guide' the sections on plot() methods creating a new vignette titled 'Plot Methods'.

ggspectra 0.1.8

Add support for plot.qty = "absorptance" to plot.filter_spct() Add support for plot.qty to plot.object_spct() with possible values: "all" or NULL (previous behaviour, and current default), "transmittance", "absorbance", "absorptance", and "reflectance". The new options plot only one quantity at a time as a line instead of the default area plot.

ggspectra 0.1.7

Add stat_wb_label(), stat_wb_e_irrad(), stat_wb_q_irrad(), stat_wb_e_sirrad(), and stat_wb_q_irrad(). Revise plot.raw_spct() to handle multiple "counts" columns. Revise plot.cps_spct() to handle multiple "cps" columns. Add text.size parameter to all plot() methods. Can be used to control the size of the font used for text decorations related to wavebands, peaks and valleys. Increase slightly the default font size for plot decorations, and decrease the number of peaks and valleys labelled by the plot() methods. Fix existing bug revealed by dplyr update. Fix bug in decoration() affecting plot.objects_spct(). Fix other minor bugs.

ggspectra 0.1.6

Clean documentation and code for CRAN submission. Add examples of plotting of waveband objects as these were removed from the vignette of package 'photobiologyWavebands'.

ggspectra 0.1.5

Fix bug in documentation.

ggspectra 0.1.4

Improve documentation.

ggspectra 0.1.3

Remove wb_guide() Remove wb_wb_summary() Add stat_wb_mean(), stat_wb_total(), stat_wb_contribution(), stat_wb_relative() Add stat_wb_irrad(), stat_wb_sirrad()

Implement 100% of the old functionality of the plot() methods, but without using any annotations. In other words, now all calculations work as expected with grouping and panels. Some aesthetics may require tweaking in the case of grouping.

Tested with packages ggrepel and cowplot.

ggspectra 0.1.2

Add text explaining examples to User Guide.

Rename several stats and functions with more descriptive names.

stat_color_guide() -> stat_wl_strip() stat_average() -> stat_wl_summary() stat_waveband() -> stat_wb_summary() color_guide() -> wl_guide() waveband_guide() -> wb_guide()

ggspectra 0.1.1

Add multiplot() function (unchanged from package photobiologygg). Improve stat_waveband(). Add color_guide(), waveband_guide().

Add ggplot() methods for spectra, which use default mappings if mapping not explicitly supplied as argument to call.

Make plot() methods almost fully functional. "contribution" and "participation" summary values not yet implemented. Neither summaries for BSWFs. If requested these summaries will show as "NaN" (not a number) in the plots.

ggspectra 0.1.0

First preview version. Still with incomplete functionality.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.2.4-1 by Pedro J. Aphalo, 13 days ago

https://www.r4photobiology.info, https://bitbucket.org/aphalo/ggspectra

Report a bug at https://bitbucket.org/aphalo/ggspectra

Browse source code at https://github.com/cran/ggspectra

Authors: Pedro J. Aphalo [aut, cre] (<https://orcid.org/0000-0003-3385-972X>), Titta K. Kotilainen [ctb] (<https://orcid.org/0000-0002-2822-9734>)

Documentation:   PDF Manual  

GPL (>= 2) license

Imports photobiology, photobiologyWavebands, scales, ggplot2, ggrepel, dplyr, lubridate, tidyr

Suggests knitr, rmarkdown

Suggested by photobiologyFilters, photobiologyInOut, photobiologyLEDs, photobiologyLamps, photobiologyPlants, photobiologySensors, photobiologySun.

See at CRAN