How to label Y_ticks for a multi line plot using a for loop

3 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Chunru
Chunru el 26 de Ag. de 2022
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)))

Más respuestas (0)

Categorías

Más información sobre Labels and Annotations en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by