MATLAB Answers


Figures saving in partial gray-scale

Asked by Kate
on 24 Jan 2013

I am using the following command to create an animated gif


Although the graphic looks correct on the screen within Matlab, when I open the test movie, some (not all) of the colors turned to gray. The animated gif only shows red, yellow, blue and gray.

I have also had this problem happen before when using the print -depsc2 command with contoured figures. Although the plot itself looks correct, the colorbar is incorrect and only shows red, blue, yellow, and gray.

Does anyone know what the problem is and how to fix it?

Any help would be appreciated.



What are you passing in for "map" ?

on 25 Jan 2013

I get the variable "map" from the following lines:

set(gca,'nextplot','replacechildren','visible','on') f = getframe(gcf); [im,map] = rgb2ind(f.cdata,256,'nodither');

It looks like it's saving map as a 12x3 matrix, even though my colormap is a much larger matrix (around 100x3).


No products are associated with this question.

0 Answers

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!