Hold function combining graphs

조회 수: 9 (최근 30일)
Hamza
Hamza 2022년 9월 21일
댓글: dpb 2022년 9월 22일
im trying to plot two graphs, and have used two hold functions, yet it is combining all the plots in one single graph.

답변 (1개)

dpb
dpb 2022년 9월 21일
Don't use hold on for separate plots, it's specifically to add more to a given figure/axes.
Insert
figure
instead, before each new plotting sequence where you want a new plot.
  댓글 수: 2
Hamza
Hamza 2022년 9월 22일
i dont seem to understand how figure works. can you help with an example? the docs arent helping either
dpb
dpb 2022년 9월 22일
figure by itself creates a new figure...figure(N) either makes the specific figure current if it already exists or makes a new one of the number/handle if it doesn't.
Not much else to understand -- if you want new plots not to overwrite or to add on to the existing then you use figure first. Each figure starts out empty; you then add what is wanted; axes, plot and their compatriots add a single axes to the figure.
Or, if you want multiple axes in a single figure, then see tiledlayout and nexttile

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by