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

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

Thanks. I able to see:
However, I can I like delete/edit or change some of the displayname?
AlignVertexCenters: 'off'
Annotation: [1×1 matlab.graphics.eventdata.Annotation]
BeingDeleted: 'off'
BusyAction: 'queue'
ButtonDownFcn: ''
Children: [0×0 GraphicsPlaceholder]
Clipping: 'on'
Color: [0.9290 0.6940 0.1250]
CreateFcn: ''
DeleteFcn: ''
DisplayName: 'width (half-prominence)'
HandleVisibility: 'on'
HitTest: 'on'
Interruptible: 'on'
LineJoin: 'round'
LineStyle: '-'
LineWidth: 0.5000
Marker: 'none'
MarkerEdgeColor: 'auto'
MarkerFaceColor: 'none'
MarkerIndices: [1 2 3 4 5 6]
MarkerSize: 6
Parent: [1×1 Axes]
PickableParts: 'visible'
Selected: 'off'
SelectionHighlight: 'on'
Tag: 'HalfProminenceWidth'
Type: 'line'
UIContextMenu: [0×0 GraphicsPlaceholder]
UserData: []
Visible: 'on'
XData: [0.1759 0.2190 NaN 0.4687 0.5313 NaN]
YData: [5.4652 5.4652 NaN -1.2093 -1.2093 NaN]
ZData: [1×0 double]
I got your meaning. Thanks.
It only able to change the 4th lable which is width (half-prominence).
How about change the colour?
Noted. But how to change the colour of
Color: [0.9290 0.6940 0.1250]
I tried help set but could not find how to change the colour
Do you have any ideas how to change the colour of the line?

Sign in to comment.

Answers (1)

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

9 Comments

Sorry, is not changing the title of graph.
I mean changing the "box display" (As i circle in red colour).
i think is change inside the function findpeaks.m
I got your point. just use
legend('abc');
after findpeak() function it will work.
Thanks
thanks. But it only have shown abc and deleted others
Use '--b' parameter in findpeak(....,'--b') function. You can use '--r' for red color
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{:});
findpeaks(PeakSig,x,'MinPeakProminence',4,'Annotate','extents');
legend({'xyz','abc'},'FontSize',12,'TextColor','green');
use this command it will works perfect for you.
Thanks
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.

Categories

Asked:

on 16 Feb 2020

Commented:

on 17 Feb 2020

Community Treasure Hunt

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

Start Hunting!