-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x-axis displaced curve after smooth with procspec #234
Comments
Hi @juandemedel - that’s odd, but shouldn’t be hard to fix. Would you mind providing a little data + code to reproduce the issue? I can’t seem to make it happen. |
Hello Mr. Thomas White. Sadly I can not provide data but I can show my code: library(pavo) library(readxl) DataSample <- read_excel("DataSample.xlsx") DataSample is.rspec(DataSample) as.rspec(DataSample, interp = FALSE) specs <- procspec(DataSample, opt = c("max", "min")) levels <- gsub(".[A-Z]", "", names(specs))[-1] table(levels) mspecs <- aggspec(specs, by = levels, FUN = mean) is.rspec(mspecs) plot(mspecs) aggplot(specs, by=levels, FUN.center = mean, FUN.error = sd, ylim = c(0, 1), axis(2, at=c(0,1)) spec.sm <- procspec(mspecs, opt = c("smooth"), span = 0.05) plot(spec.sm, ylab="Transmittance", yaxt = "n") plot(mspecs[, 2] ~ specs[, 1], type = 'l', lwd = 10, col = 'grey', lines(spec.sm[, 2] ~ specs[, 1], col = 'red', lwd = 1) |
Hi @juandemedel, @Bisaloo has mostly cracked it, but for now if you're in need of a quick solution you'll just need to interpolate your spectra (with If for some analytical reason you really can't interpolate the data though, then we're still looking into the specifics of the bug and will update when we've figured it out one way or the other. |
Thank you so much Doctor Thomas White. I ran again the code and it worked as I wanted. |
Hi again @juandemedel, thanks for your bug report. The issue should now be solved. You can now use library(pavo)
#> Welcome to pavo 2! Take a look at the latest features (and update your bibliography) in our recent publication: Maia R., Gruson H., Endler J. A., White T. E. (2019) pavo 2: new tools for the spectral and spatial analysis of colour in R. Methods in Ecology and Evolution, 10, 1097-1107.
# Uninterpolated spectra
helio <- lightr::lr_get_spec(
system.file("testdata", "heliomaster", package = "lightr"),
ext = "jdx", interpolate = FALSE
)
#> 4 files found; importing spectra:
helio_smoothed <- procspec(helio, "smooth", span = 0.1)
#> processing options applied:
#> smoothing spectra with a span of 0.1
plot(merge(helio, helio_smoothed), col = rep(c("black", "red"), each = 4)) Created on 2022-06-17 by the reprex package (v2.0.1.9000) For this to work, you will need to install the development version of pavo by running the following code: install.packages("remotes")
remotes::install_github("rmaia/pavo") |
Hello dear community. I'm new here. I've plotting spectral transmittance data using pavo. However, when smooth my curves with procspec I get my curves displaced in x-axis to the right. Would you please give me some advice to fix them?
The text was updated successfully, but these errors were encountered: