How to change the properties of legend?

조회 수: 11 (최근 30일)
Emerson De Souza
Emerson De Souza 2013년 8월 16일
INTRO: Hi, I use the command pulsewidth(data,time) to display the width of peaks as described in the example below:
clear all; close all;
% DATA GENERATION
Fs = 1000;
time = 0:1/Fs:1;
Frq = 10;
data = sin(2*pi*time*Frq);
% CALCULATE AND PLOT PULSEWIDTH
pulsewidth(data,time);figure(gcf);
legend('Location', 'NorthEast');
% PLOT PROPERTIES
box on;
set(gca,'FontSize',18, 'FontName','Arial', 'FontWeight','bold','Color','w','LineWidth',3);
xlabel('TIME','FontSize',18, 'FontName','Arial','FontWeight','bold');
ylabel('AMPLITUDE','FontSize',18, 'FontName','Arial','FontWeight','bold');
scrsz = get(0,'ScreenSize'); set(gcf,'Position',scrsz,'PaperPositionMode','auto');
QUESTION: How can I change the thickness of the lines and the sizes of the symbols displayed in the legend?
This legend is generated automatic with the command pulsewidth and I don't have access to the data. The only thing I could do until now was to fix the location of the legend.
I hope someone knows how to help me.
Thanks in advance
Emerson

채택된 답변

dpb
dpb 2013년 8월 16일
From the doc for legend --
LEGH = legend returns the handle to legend on the current axes or empty if none exists.
So, after your call to pulsewidth, include
lh=legend; % return the legend handle
then you can do whatever you want w/ the properties thereof
  댓글 수: 6
Emerson De Souza
Emerson De Souza 2013년 8월 21일
Thank you, I read your suggestions and tried different things until it worked.
dpb
dpb 2013년 8월 21일
That's the way to get somewhere w/ handle graphics--seems daunting 'cuz there's so much folderol to deal with with the large number of objects and properties and there's no way to find in documentation except by a very deep hunt keeping on drilling down so all one can do is dig in and start...
But, once you do it a time or two you get the hang of the general idea and then it's just "handle diving" to find what it is they called whatever the property is that does the effect desired for the most part...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by