How do I create a MATLAB MOVIE with a fixed range for the COLORBAR?

12 次查看(过去 30 天)
When I create a MATLAB MOVIE that has figures with varying color ranges, the COLORBAR for each figure is different. Therefore, when I use the MOVIE command, it creates a movie with a COLORBAR that has a varying range.

采纳的回答

MathWorks Support Team
To create a MOVIE that has a fixed range for the COLORBAR, you first need to either determine the maximum and minimum color limits (CLIM) of your movie slides or predetermine the color limits (CAXIS). Once you have decided on the color limits, you can then set them using the CAXIS function before you create your MATLAB MOVIE.
Here is an example program that shows how to do this:
[x y] = meshgrid(-40:1:40); % create your movie slides
set(gca, 'nextplot', 'replacechildren');
caxis manual; % allow subsequent plots to use the same color limits
caxis([-1 1]); % set the color axis scaling to your min and max color limits
% now record the movie
k=0.05;
wt=-2:0.1:2;
for j=1:length(wt)
imagf = -x./(x.^2+1);
realf = 1./(x.^2+1);
z = cos(k*y-wt(j)).*imagf+sin(k*y-wt(j)).*realf;
contour(x,y,z);
axis off;
pcolor(x,y,z);
shading interp;
colorbar; % add the colorbar
F(j) = getframe(gcf); % capture the complete figure which includes the colorbar
lighting phong;
end
The above code creates a MATLAB MOVIE that has a fixed range for the COLORBAR.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by