I was trying to plot multipanel average reflectance spectra and their standard deviations using hyperSpec
package. But I am not getting the desired results. I am having 10 clusters/groups but plotting is giving me only 4 clusters. Also, the groups are not coming in proper order. I am using the following code
library(hyperSpec)
data_1 <- read.csv("Multipanel_plotting.csv")
data <- data[-1]
wl <- seq (350, 2500,1)
cluster <- as.factor(data_1$clusters)
spectra <- new ("hyperSpec", spc = data, data = data.frame(cluster),
labels = list (.wavelength = "Wavelength (nm)",
spc = "Reflactance"), wavelength = wl)
#Multipanel plotting
qplotspc(aggregate(spectra, spectra$cluster, mean_pm_sd),
mapping = aes(x = .wavelength,
y = spc,
colour = cluster)) +
facet_grid(cluster ~.) + ggtitle("Spectra")
But I want to have the plot like this
I am providing the google drive link of the dataset https://drive.google.com/file/d/1I_VlNbFTwi10fn3yNE4HknhpjreZKotV/view?usp=sharing
Any help in this regard is highly appreciated.