Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 204771

How to make multipanel hyperspectral data plotting in R?

$
0
0

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")

This is giving me enter image description here

But I want to have the plot like this

enter image description here

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.


Viewing all articles
Browse latest Browse all 204771

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>