matlab cbfreeze,freezeColors.m

freezeColors是一个用于锁定MATLAB图形中颜色的函数,允许在同一图表中使用多个颜色映射。它通过将索引颜色数据转换为真彩色RGB来防止后续更改colormap或caxis影响已冻结的对象。该函数适用于各种图形对象,如曲面、图像、散点图等。同时,文章指出对于颜色条,需要使用CBFREEZE函数来冻结。
摘要由CSDN通过智能技术生成

function freezeColors(varargin)

% freezeColors Lock colors of plot, enabling multiple colormaps per figure. (v2.3)

%

% Problem: There is only one colormap per figure. This function provides

% an easy solution when plots using different colomaps are desired

% in the same figure.

%

% freezeColors freezes the colors of graphics objects in the current axis so

% that subsequent changes to the colormap (or caxis) will not change the

% colors of these objects. freezeColors works on any graphics object

% with CData in indexed-color mode: surfaces, images, scattergroups,

% bargroups, patches, etc. It works by converting CData to true-color rgb

% based on the colormap active at the time freezeColors is called.

%

% The original indexed color data is saved, and can be restored using

% unfreezeColors, making the plot once again subject to the colormap and

% caxis.

%

%

% Usage:

% freezeColors applies to all objects in current axis (gca),

% freezeColors(axh) same, but works on axis axh.

%

% Example:

% subplot(2,1,1); imagesc(X); colormap hot; freezeColors

% subplot(2,1,2); imagesc(Y); colormap hsv; freezeColors etc...

%

% Note: colorbars must also be frozen. Due to Matlab 'improvements' this can

%no longer be done with freezeColors. Instead, please

%use the function CBFREEZE by Carlos Adrian Vargas Aguilera

%that can be downloaded from the MATLAB File Exchange

%(http://www.mathworks.com/matlabcentral/fileexchange/24371)

%

% h=colorbar; cbfreeze(h), or simply cbfreeze(colorbar)

%

% For additional examples, see test/test_main.m

%

% Side effect on render mode: freezeColors does not work with the painters

% renderer, because Matlab doesn't support rgb color data in

% painters mode. If the current renderer is painters, freezeColors

% changes it to zbuffer. This may have unexpected effects on other aspects

% of your plots.

%

% See also unfreezeColors, freezeColors_pub.html, cbfreeze.

%

%

% John Iversen (iversen@nsi.edu)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值