ggspectra 0.3.5

The changes from version 0.3.4, the current CRAN release, are:

  • Track changes in ‘photobiology’ 0.9.30 to the value returned by getWhereMeasured() which could in very specific cases trigger errors.
  • Revise ggplot() methods so that the class and attributes of spectral objects are retained in the data member of the gg object. This allows use of methods
    specific to spectra in data transformations in pipes passed as arguments to the data parameter of layer functions.

Example of what is now possible:


ggplot(sun.spct) +
  geom_line() +
  geom_line(data = . %>% smooth_spct(method = "supsmu"),
            colour = "red", size = 1.2)

Note: When mapping is done within ggplot(), layer functions only “see” a data frame with variables according to aesthetics. This means that smooth_spct() cannot be used as a method in stat_smooth().

Plot returned by the code above.

Documentation web site at

NOTE: The updated package is on its way to CRAN.

Please raise issues concerning bugs or enhancements to this package through Bitbucket at

Share with

Leave a Reply