hist_find_peaks.minvalue | R Documentation |
Find peaks in given histgram. The peaks are devided by the majority of peak devision with changing threshold of the ignoring values [min,max].
hist_find_peaks.minvalue(hist.data, min, max, n = 101)
hist.data |
The target histgram |
min |
The minmum value of the threshold. |
max |
The maximum value of the threshold. |
n |
The step of the threshold change. |
Table of the peaks with lower number, upper number, top number (maximum position within the peak) and frequency of each peaks.
hist.data = c(1,5,7,5,5,4,3,1,0,0,0,4,4,8,5,5,5,5,3,3,3,7,7,8,3,3,1,3,5,0,0,2,3,3,0)
peaks = hist_find_peaks.minvalue(hist.data,0,6)
plot(hist.data,type="b",lwd=2)
for(i in 1:nrow(peaks)){
segments(peaks$top[i],-1,peaks$top[i],10,col="red")
polygon(
c(peaks$lower[i],peaks$lower[i],peaks$upper[i],peaks$upper[i]),c(-1,10,10,-1),
col=rgb(1,0,0,0.2),border=NA
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.