MatPlotLib "Perceptually Uniform" Colormaps

版本 2.1.7 (1.2 MB) 作者: Stephen23
MatPlotLib's default linear lightness colormap VIRIDIS and distinctive line colororder TAB10
7.7K 次下载
更新时间 2025/12/6

查看许可证

From MatPlotLib 2 and 3:
  • the default sequential colormap VIRIDIS (as well as INFERNO, MAGMA, and PLASMA),
  • the default line colororder TAB10 (as well as TAB20, TAB20B, and TAB20C),
  • the cyclic colormaps TWILIGHT and TWILIGHT_SHIFTED,
  • the colorblind-friendly sequential colormap CIVIDIS.
For MatPlotLib 2.0 new colormaps were generated in the CAM02-UCS colorspace to have a constant change in lightness over the entire colormap. The process is described here:
The default colormap was changed to the newly created VIRIDIS (replacing the anti-pattern JET/RAINBOW) and the default line colororder changed to VEGA10 (note that the VEGA# colormaps were renamed TAB# in MatPlotLib 3), as described here:
The RGB data were obtained from:
COLORMAP Examples
%% Plot the scheme's RGB values:
rgbplot(viridis(256))
%% New colors for the COLORMAP example:
load spine
imagesc(X)
colormap(viridis)
%% New colors for the SURF example:
[X,Y,Z] = peaks(30);
surfc(X,Y,Z)
colormap(viridis)
axis([-3,3,-3,3,-10,5])
COLORORDER Examples
%% PLOT using matrices:
N = 10;
X = linspace(0,pi*3,1000);
Y = bsxfun(@(x,n)sqrt(n)*sin(x+2*n*pi/N), X(:), 1:N);
plot(X,Y, 'linewidth',4)
colororder(tab10(N))
%% PLOT in a loop:
N = 10;
colororder(tab10(N))
X = linspace(0,pi*3,1000);
Y = bsxfun(@(x,n)sqrt(n)*sin(x+2*n*pi/N), X(:), 1:N);
for n = 1:N
plot(X(:),Y(:,n), 'linewidth',4);
hold on
end
%% LINE using matrices:
N = 10;
X = linspace(0,pi*3,1000);
Y = bsxfun(@(x,n)sqrt(n)*cos(x+2*n*pi/N), X(:), 1:N);
line(X(:),Y)
colororder(tab10(N))

引用格式

Stephen23 (2026). MatPlotLib "Perceptually Uniform" Colormaps (https://ww2.mathworks.cn/matlabcentral/fileexchange/62729-matplotlib-perceptually-uniform-colormaps), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2010b
与 R2009b 及更高版本兼容
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Color and Styling 的更多信息
标签 添加标签
版本 已发布 发行说明
2.1.7

* Add uniformity plot to HTML.

2.1.6

* Add demo function.
* Improve documentation.

2.1.5

* Documentation improvements

2.1.4

* Documentation improvement.

2.1.3

* Update image aspect ratio

2.1.2

* Update image aspect ratio.

2.1.1

* Update image.

2.1.0

* Update to use HG2 default map length.
* Add TWILIGHT_SHIFTED

2.0.3

* Better overview image.

2.0.2

* Add error IDs.

2.0.1

Add YouTube link to description.

2.0.0

* Include colormaps CIVIDIS and TWILIGHT
* Rename VEGA* to TAB*, matching MatPlotLib 3