필터 지우기
필터 지우기

Effect of hold command on plot axes

조회 수: 1 (최근 30일)
Chuzymatics Chuzymatics
Chuzymatics Chuzymatics 2014년 7월 30일
답변: dpb 2014년 7월 30일
Pls could somebody run the code below and comment on why the axes of the plot are incomplete. Intuitively, I think it's one of the effects of the hold on/off command. Also, the set(...) command threw up errors and I commented them off.
% Demonstration of hold command
angle = 0:30:360;
y1 = 3*cosd(angle);
y2= 10*sind(angle);
clf
hold on
plot(angle, y1, '-sg','lineWidth', 2)
plot(angle, y2, '-dr','lineWidth', 2)
title('Demo of hold command')
hold off
%set(y1,'color', 'r')
%set(y2,'color', 'g')
legend('3*cos(angle)','10*sin(angle)')
%[x, y] = ginput
set(gca, 'lineWidth', 2)

답변 (1개)

dpb
dpb 2014년 7월 30일
Yes, setting hold on before plotting tends to foul things up -- why would you do that, anyway?
The problem with the set command is that y1 and y2 aren't handle graphics objects handles -- you should save the line handles from the calls to plot to use to modify.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by