Hide peaks ticks and number on plots
Mostra commenti meno recenti
Hi all,
I am trying to hide the text above some peaks in the following plot. I would need to display only the following peaks:
3,4
7,8,9,10,11,12,13,14,15,16,17,18,19,20
(as highlighted in the figure)
Here is the plot:

The code I used to produce the plot is the following:
load('pO2,Mean,Numeric,Float,Raumedic,data_part1of1.mat');
ox = measurement_data;
smooth_ox = smooth(ox, 0.01, 'loess');
%find peaks
[pks,locs,wdths] = findpeaks(smooth_ox,'MinPeakProminence',0.5);
locmax = islocalmax(smooth_ox);
figure()
findpeaks(smooth_ox,'MinPeakProminence',0.5);
text(locs+.02,pks,num2str((1:numel(pks))'))
title('Peaks')
ylim([25 70]);
Thank youin advance for the help!
Risposte (2)
KSSV
il 6 Ago 2021
Try:
load('pO2,Mean,Numeric,Float,Raumedic,data_part1of1.mat');
ox = measurement_data;
smooth_ox = smooth(ox, 0.01, 'loess');
%find peaks
% [pks,locs,wdths] = findpeaks(smooth_ox,'MinPeakProminence',0.5);
% locmax = islocalmax(smooth_ox);
figure()
findpeaks(smooth_ox,'MinPeakProminence',0.5);
% text(locs+.02,pks,num2str((1:numel(pks))'))
title('Peaks')
ylim([25 70]);
2 Commenti
Luca de Freitas
il 6 Ago 2021
KSSV
il 6 Ago 2021
You can get location indieces of the peaks, pick only those which you want to display and annotate or mark them.
Star Strider
il 6 Ago 2021
There is likely no way to select only those peaks, since there does not appear to be anything that distinguishes them, unless that information is in the original data.
So, just subscript them and be done with it:
selpks = [3,4, 7:numel(pks)];
text(locs(selpks)+.02,pks(selpks),num2str((1:numel(pks))'))
.
Categorie
Scopri di più su Descriptive Statistics in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
