2 feb. 2018

Std Dev vs. Mean Centered Spectrum

This is a plot which shows the mean centered spectra treated with Multiple Scatter Correction, and over plotted is the estándar deviation values of the mean centered values at each wavelength.
The idea is to create a plot with different scales and laves in the axes, and the result is quite nice with this code:

## Plotting the Standard Deviation Spectrum
X_msc_mc_sd<-as.matrix(apply(X_msc_mc,2,sd))
par(mar=c(5, 4, 4, 6))
matplot(wavelengths,t(X_msc_mc),type="l",col="grey",
        xlab="",ylab="",axes=FALSE)
mtext("Absorbancia",side=4,col="grey",line=3)
axis(4,col="grey",col.axis="grey",las=1)
par(new=TRUE)
matplot(wavelengths,X_msc_mc_sd,lty=1,pch=NULL,axes=FALSE,
        type="l",col="red",lwd=2,xlab="Wavelength",ylab="",
        main= "Std Dev vs Mean centered spectra")
axis(2,col="red",col.axis="red",las=1)
mtext("Standard Deviation",col="red",side=2,line=3)
axis(1,col="black",col.axis="black",las=1)
box()


Practice with this example.

No hay comentarios:

Publicar un comentario