How to label Y_ticks for a multi line plot using a for loop
조회 수: 4 (최근 30일)
이전 댓글 표시
I am making a multiline plot however I want the y-tick labels to represent each iteration (i) in the loop, instead of just giving me 4 ticks. I need this to help me identify which signal number to remove in my preprocessing. Below is a sample data to recreate the plot.
channel_n = size(all_trials);
all_trials = ones([15,15]);
x_axis = linspace(-0.1, 0.3, length(all_trials));
for i = 1:channel_n(1)
figure(1)
plot(x_axis, abs(all_trials(:,i)) + 0.2*(i-1), 'b', 'linewidth',1.2), axis auto
title(name + "Waterfall Plot"')
hold on
end
hold off
댓글 수: 0
채택된 답변
Chunru
2022년 8월 26일
all_trials = randn(15, 15)*.1;
channel_n = size(all_trials, 2);
%all_trials = ones([15,15]);
x_axis = linspace(-0.1, 0.3, size(all_trials, 1));
figure(1); hold on
for i = 1:channel_n
plot(x_axis, abs(all_trials(:,i)) + 0.2*(i-1), 'b', 'linewidth',1.2), axis auto
end
title("Waterfall Plot"');
hold off
yticks((0:channel_n-1)*0.2)
yticklabels(string((0:channel_n-1)))
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Labels and Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!