Skip to content

Commit

Permalink
Update f.plot.spec.R
Browse files Browse the repository at this point in the history
Small change to handle NA values
  • Loading branch information
JulienLamour authored Dec 20, 2023
1 parent e5e0bab commit f0d01d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/f.plot.spec.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ f.plot.spec <- function(
){
if(mean(as.matrix(Z),na.rm=TRUE)>1){Z=Z/100} ## Check if the spectra are in pc [0,100] or in [0,1]
if(is.null(xlim)){xlim=c(min(wv),max(wv))}
mean_spec <- colMeans(Z)
mean_spec <- colMeans(Z,na.rm=TRUE)
spectra_quantiles <- apply(Z,2,quantile,na.rm=T,probs=c(0,0.025,0.05,0.5,0.95,0.975,1))

plot(x=NULL,y=NULL,ylim=c(0,100),xlim=xlim,xlab="Wavelength (nm)",
Expand All @@ -35,4 +35,4 @@ f.plot.spec <- function(
legend(position,legend=c(paste("Mean",type),"Min/Max", "95% CI"),lty=c(1,3,1),
lwd=c(2,1,10),col=c("black","grey40","#99CC99"),bty="n")
box(lwd=2.2)
}
}

0 comments on commit f0d01d0

Please sign in to comment.