Hide peaks ticks and number on plots

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)

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

The result I get is this.
Do you know how to hide only a couple of ticks? If you look back at the other figure, I would need to hide only text (tick + number) from peaks 1,2,5,6,21,22,23.
Thank you for answering!
You can get location indieces of the peaks, pick only those which you want to display and annotate or mark them.

Accedi per commentare.

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))'))
.

2 Commenti

Thank you again! I have solved it by plottng the original data with 'plot' and then plotting the selected indexes in the same graph!
My pleasure!
.

Accedi per commentare.

Richiesto:

il 6 Ago 2021

Commentato:

il 6 Ago 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by