Colors for plotting

Version 1.0.0.0 (1,09 KB) von Giorgos
Provides color variation for line plots.
792 Downloads
Aktualisiert 18. Sep 2013

Lizenz anzeigen

For multiple plots on the same figure, current color schemes are often not satisfactory. This function provides a smooth transition from red, through green, to blue. The function is especially suited for visualisation of the dependence of a variable over small variations of a parameter.

The following two ways can be used to reproduce the screenshot:

Color definition:
N = 50;
ColorSet = ColorBand(N);

Some data:
x = zeros(N, 2);
y = zeros(N, 2);
x(:,2) = N:-1:1;
y(:,2) = 1:N;

a) Separately set the color of each plot:
figure
hold on
for m = 1:N
plot(x(m,:), y(m,:), 'color', ColorSet(m,:));
end

b) Manually set the color order:
figure
hold all
set(gca, 'ColorOrder', ColorSet);
for m = 1:N
plot(x(m,:), y(m,:));
end

Special thanks to Jiro for the construction of a visually appealing example. See his blog on http://blogs.mathworks.com/pick/2008/08/15/colors-for-your-multi-line-plots/

Zitieren als

Giorgos (2026). Colors for plotting (https://de.mathworks.com/matlabcentral/fileexchange/43548-colors-for-plotting), MATLAB Central File Exchange. Abgerufen.

Kompatibilität der MATLAB-Version
Erstellt mit R2012a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Data Exploration finden Sie in Help Center und MATLAB Answers
Quellenangaben

Inspiriert von: varycolor

Version Veröffentlicht Versionshinweise
1.0.0.0