필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

plot multiple graphs in same plot alligned

조회 수: 1 (최근 30일)
Salvatore Lacava
Salvatore Lacava 2018년 7월 9일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi everybody, I am creating multiple plots within a for loop but what I would like instead is to have just one plot with multiple lines (one created by each iteration of the for loop). Those plots share the same values for the x axis but different ranges for the y, so it would be really convenient to have them alligned on the same "line", given that I don't care about the absolute values on the y axis. Any suggestions is much appreciated!
  댓글 수: 4
Salvatore Lacava
Salvatore Lacava 2018년 7월 9일
The first one that you say: varying the same amount but btw different numbers
@Adam: the way how I usually do this is by using hold on. The problem is this does not work here, because the way how I produce the plot is by using a function in the loop. This is roughly how I do it:
for i = 1:10
hold on
function_to_plot(A(i)) %where A is a vector
end
But this produces multiple plots, not one plot
Adam
Adam 2018년 7월 9일
You should always give an explicit axes handle to all plotting instructions, e.g.
hold( hAxes, 'on' );
plot( hAxes, xData, yData,... );
etc. Then if you want things on the same axes that is where they will appear.

답변 (1개)

dpb
dpb 2018년 7월 9일
Then standardize the y data before plotting each line in a consistent fashion -- one way would be as Answer_327905 Another alternative might be to use the z-score of
z=(x-mu)/sigma
Many other choices possible depending upon just what the data represent as to what might make most sense.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by