How to plot with diferents colors

1 visualización (últimos 30 días)
Gabriela Sousa
Gabriela Sousa el 29 de Mayo de 2020
Respondida: Image Analyst el 29 de Mayo de 2020
Hello! I would like to differentiate types of filter and signals with and without noise, but I am not able to differentiate the noise part.
no_noise = plot(number_projections, SER_no_noise(:, :));
hold on;
with_noise = plot(number_projections, reshape(SER_with_noise(:, length(variance), :),...
[length(tests_to_run), length(number_projections)]));
h = [no_noise; with_noise];
legend(h, 'shep-logan NO NOISE','Cosine NO NOISE', 'ram-lak NO NOISE', 'Hann NO NOISE', 'Hamming NO NOISE',...
'shep-logan WITH NOISE','Cosine WITH NOISE', 'ram-lak WITH NOISE', 'Hann WITH NOISE', 'Hamming WITH NOISE')

Respuestas (2)

Ameer Hamza
Ameer Hamza el 29 de Mayo de 2020
Editada: Ameer Hamza el 29 de Mayo de 2020
By default, the MATLAB axes only use seven colors to plot the lines. After that, the sequence is repeated if there are more then seven lines: https://www.mathworks.com/help/releases/R2020a/matlab/ref/matlab.graphics.axis.axes-properties.html#budumk7_sep_shared-ColorOrder. You can define your own colors to make them more distinguishable. For example
ax = axes()
ax.ColorOrder = rand(10,3); % define 10 rgb colors randomly. You can write your own matrix instead of using rand()
no_noise = plot(number_projections, SER_no_noise(:, :));
hold on;
with_noise = plot(number_projections, reshape(SER_with_noise(:, length(variance), :),...
[length(tests_to_run), length(number_projections)]));
h = [no_noise; with_noise];
legend(h, 'shep-logan NO NOISE','Cosine NO NOISE', 'ram-lak NO NOISE', 'Hann NO NOISE', 'Hamming NO NOISE',...
'shep-logan WITH NOISE','Cosine WITH NOISE', 'ram-lak WITH NOISE', 'Hann WITH NOISE', 'Hamming WITH NOISE')

Image Analyst
Image Analyst el 29 de Mayo de 2020

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by