MATLAB R2014b switch back to old color scheme? - matlab

As announced, MATLAB R2014b adopts a new color scheme, which sort of replaces red with orange and blue to gray blue.
I would like to opt back for the old scheme. How may I do this?
P.S.:
If I am simply plotting dot, lines, and all that, I can just specify the color myself. However, this is not the case.
I am calling a sophisticated drawing function, which displays the heat map with the MATLAB color scheme. They used to be "blue for cold, and red for hot", and now they become "gray blue for cold, and yellow for hot". It is just counter-intuitive!
Therefore, to avoid modifying the function, I would rather switch the whole graphics system back to pre-R2014b scheme.

The old default colormap is still available - it's called jet.
If you want to set the colormap for individual axes or figures back to the old default, you can do that with colormap(figHandle, jet) or colormap(axesHandle, jet).
To change it for all your plots, try set(groot, 'DefaultFigureColormap', jet). You may need to set that each time you start MATLAB, so perhaps you might want to put the command into a startup.m file.
However I'm not sure I agree that the new colormap is less intuitive; in fact there is quite a bit of solid evidence that it is much worse in some very specific ways. That's why they changed it. Your choice though...

Related

Plots all red and green

I seem to have made some settings change where all of my MATLAB plots (plot, plot3, surf, etc) show up in this red/green color scale:
I searched around forums and the MATLAB user guide but am not finding anything. It's not a huge deal, as I can enter code to fix this on each plot, but I shouldn't have to.
How to fix this?
Check startup.m you seem to have set your default colormap to autumn or something. Just put it back to either jet (pre 2015a), or parula.
I don't know about the whole settings. These two commands can reset a figure properties (including its colormap) to its default values:
h=gcf;
reset(h)
This way you assign a handle to the last figure you have. Then, the second command resets its options to default values.
Update after Adrian's comment: Check out this page: Default Property Values It clearly shows how is it possible to regenrate the problem you have and you might need use the remove option for removing user-defined default value. There is a factory defined colormap accessible by the function: get(groot,'factoryFigureColormap'). This might help you too.

MATLAB R2014b: Rendering plots with lines in the same place

Since version R2014b, MATLAB now renders graphics nicely anti-aliased (finally!)
However, this causes a glitch in the way it displays some of my figures. If I plot a line, use hold on and then plot another line in exactly the same place with a different colour, the line appears in a mottled combination of both colours. In the past, the line would simply appear as the last colour that was plotted in that location.
Here's an example of a trace in blue, with some sections (the steeper bits) showing a green line. In previous MATLAB versions, the green lines would be continuous, but now some of the blue line shows through.
Is there a neat way to work around this in the new version, or do I have to ensure that I remove any existing lines before plotting in the same place?
When overplotting, the new anti aliasing plots can have some bleed through, try
set(gcf,'GraphicsSmoothing','off')
To see if it restores the functionality you're used to.
Ref:
http://www.mathworks.com/matlabcentral/answers/157758-how-do-i-turn-off-antialiasing-in-matlab-r2014b

Matlab R2014 issue with saving colormap from colormapeditor

Simple question: in Matlab R2013, Win7(64) (actually always it was like that) after changes made in colormapeditor one can copy the values of colormap just by typing colormap or get(gcf,'Colormap') or similar. But in the version R2014 I cannot do this - no matter what I change in colormapeditor, I get the same default colormap. See this in Matlab command line:
img=surf(peaks)
colormapeditor
(now, change for instance the limit colors to red). Now use:
colormap
get(gcf,'Colormap')
you got the same default UNCHANGED colormap. However if you close colormapeditor and invoke it again it remembers changed colors.
What I'm doing wrong? Is this :New MATLAB Graphics System" responsible for that?
Thank you for help.
Yacek.
PS:
The same states if you use fig=figure first and than try get(fig,'Colormap') or fig.Colormap etc. The command colormapeditor remembers changes, but one cannot save them.
It looks like the colormap is now associated with the axes rather than the figure. So,
cmap = colormap(gca);
will retrieve the map you're looking for.

Strange behavior in Matlab when exporting figure to eps, pdf

When I make a figure in Matlab, with a legend and a rectangle that touches the y axis (strange, I know) upon exporting the figure to eps (or pdf) I've noticed that the rectangle obtains the line-style of the last line drawn (rather than what the rectangle was drawn with)
This behaviour also occurs for rectangles drawn after the one that touches the axis...
This doesn't happen if the rectangle is drawn before the legend is created....
Needless to say, it took me half a day to create a minimal example:
clf
L=plot(X,sin(X),'--');
legend(L,'sin(x)')
rectangle('position',[0.001,.1,.7,.7])
rectangle('position',[0,.5,.6,.7])
rectangle('position',[0.001,.3,.5,.7])
%legend(L,'sin(x)')
On the screen the 3 rectangle have solid lines, as they should. but once they are exported, the result has the last two with dashed lines (like the sin(x)). If the legend command is done later (as in the commented out line), everything works as it should....
Is this a feature or a bug?
This is not a feature. I am submitting this to development.
You found a workaround that works with minimal code gymnastics. I would document it in your code so someone does not change it unknowingly and move on.
If you are open to other output formats, notice this is not an issue with formats that use an output filter of MATLAB.
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/print.html
(Graphic Format Files section, right column in table)
-Doug, Advanced Support at MathWorks dealing with graphical issues.

In MATLAB, how do I change the background color of a subplot?

I'm trying to change the background color of a single subplot in a MATLAB figure.
It's clearly feasible since the UI allows it, but I cannot find the function to automate it.
I've looked into whitebg, but it changes the color scheme of the whole figure, not just the current subplot.
(I'm using MATLAB Version 6.1 by the way)
You can use the set command.
set(subplot(2,2,1),'Color','Red')
That will give you a red background in the subplot location 2,2,1.
I know you mentioned that you are using MATLAB 6.1, but it bears mentioning that in the newer versions of MATLAB you can specify additional property-value pair arguments in the initial call to SUBPLOT, allowing for a more compact syntax. The following creates an axes with a red background in the top left corner of a 2-by-2 layout:
subplot(2,2,1,'Color','r');
I'm not certain in which version of MATLAB this syntax was introduced, since the release notes going back to Version 7 (R14) don't seem to mention it.
I've not used Matlab in several years, but I think it might well be the whitebg method called after the subplot declaration, similar to the way in which you would set a title.
subplot(3, 2, 4), hist(rand(50)), whitebg('y');