Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Colormap not updating - MATLAB 2014b

35 views
Skip to first unread message

Maha

unread,
Nov 18, 2014, 10:14:11 PM11/18/14
to
Hi everyone,

With the latest version of MATLAB I am having some major issues updating my plot's colormap. I am able to plot a figure and have a colorbar just fine, then I go into colormap editor to change the colormap to what I want. However, when I save that colormap as a variable and try to apply that colormap to a new figure, it looks like none of my color choices stick! Any help would be greatly appreciated.

Here is an idea of what I do:
figure; colormap; colorbar
%% Then edit things using colormap editor, apply changes, see them take
cm = colormap;
%% Now try plotting a new figure with this custom colormap
figure; colormap(cm); colorbar
%% This colormap looks exactly like the default one I started out with.

I was able to do this in previous versions of MATLAB and I'm very confused as to what is going wrong now...

Rick Spada

unread,
Nov 19, 2014, 8:54:08 AM11/19/14
to
In 14b MATLAB Graphics introduced the ability for axes to have their own
colormaps. When you edited the colormap using the colormap editor, you were
editing the colormap for the axes. Modify your code such that when you get
the colormap, you specify the axes you want to get it from:

cm = colormap(gca);

-- Rick

"Maha " <mh...@mit.edu> wrote in message
news:m4h1tt$g3b$1...@newscl01ah.mathworks.com...

Maha

unread,
Nov 19, 2014, 9:59:15 AM11/19/14
to
That worked perfectly! Thanks a lot Rick.

"Rick Spada" <rick....@mathworks.com> wrote in message <m4i7dr$adv$1...@newscl01ah.mathworks.com>...
0 new messages