MATLAB Answers

How to change the colour or text or delete some text of the default graph in findpeaks function?

2 views (last 30 days)
Matlaber
Matlaber on 16 Feb 2020
Commented: Matlaber on 17 Feb 2020
How to change the colour or text or delete some text of the default graph in findpeaks function?
It used "findpeaks"
% generate data
x = linspace(0,1,1000);
base = 4*cos(2*pi*x);
Pos = [1 2 3 5 7 8]/10;
Hgt = [3 7 5 5 4 5];
Wdt = [1 3 3 4 2 3]/100;
for n = 1:length(Pos)
Gauss(n,:) = Hgt(n)*exp(-((x - Pos(n))/Wdt(n)).^2);
end
PeakSig = sum(Gauss)+base;
% findpeaks function
findpeaks(PeakSig,x,'MinPeakProminence',4,'Annotate','extents')

  9 Comments

Show 6 older comments

Sign in to comment.

Answers (1)

Muhammad Usama Sharaf SAAFI
use
title('');
command to change text after findpeak() function,
use
whitebg('blue');
to change color.

  9 Comments

Show 6 older comments
Matlaber
Matlaber on 17 Feb 2020
Not sure what I am doing is correct.
>> findpeaks(PeakSig,x,'MinPeakProminence',4,'Annotate','extents','--b')
Error using findpeaks>parse_inputs (line 288)
No value was given for '--b'. Name-value pair arguments require a
name followed by a value.
Error in findpeaks (line 136)
= parse_inputs(isInMATLAB,Yin,varargin{:});
Muhammad Usama Sharaf SAAFI
findpeaks(PeakSig,x,'MinPeakProminence',4,'Annotate','extents');
legend({'xyz','abc'},'FontSize',12,'TextColor','green');
use this command it will works perfect for you.
Thanks
Matlaber
Matlaber on 17 Feb 2020
Thanks for your reply.
I would like to change the colour of the line, and not the colour of the text color as shown below in circle.

Sign in to comment.

Sign in to answer this question.