Plot several graphs with distance in Y-axis!

조회 수: 14 (최근 30일)
M G
M G 2013년 9월 12일
편집: the cyclist 2022년 7월 8일
Hi Matlab experts,
If we have matrix M with the size 20x100. I want to plot 20 rows (each row has 100 points) in one figure in a way that graphs do not overlap on each other. How can I plot them with distance from each others on Y-axis while preserving the scaling? Something similar to EEG.
Thanks for your help. Mehdi

채택된 답변

the cyclist
the cyclist 2013년 9월 12일
편집: the cyclist 2022년 7월 8일
Here's one way:
% Create some data
M = 0.3*rand(20,100);
offset = 1; % Make this big enough to prevent overlap
offset_vector = (offset:offset:20*offset)';
M_plus_offset = bsxfun(@plus,M,offset_vector);
figure
plot(M_plus_offset')

추가 답변 (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