Why doesn't clabel give me a white contour label when asked...?

Why doesn't this result in a white contour with a white label ? It has on all previous versions of matlab but I'm on 2015 now and something has changed (this is from a previously working script):
v=[slim slim];
[cs,h]=contour(xsub,ysub,drhom,v,'w--');
set(h,'LineWidth',2);
clabel(cs,h,'Color','w');
I get white contours and black labels....have tried every combination of things I can think of.

Answers (2)

The behavior of the 'clabel' function changed a little in MATLAB R2014b. It is noted in the documentation (towards the bottom of the page):
"Note: Starting in R2014b, you can no longer set text properties if you pass the contour object h as an input argument to the function. For example, clabel(C,h,'Fontsize',14) does not set the font size. Use clabel(C,'FontSize',14) instead."
Try:
v=[slim slim];
[cs,h]=contour(xsub,ysub,drhom,v,'w--');
set(h,'LineWidth',2);
clabel(cs,'Color','w'); % Note that I removed "h"
If that doesn't work, a little more detail (with working code) might help. For example, what are the values of "slim", "xsub", "ysub" and "drhom", and why do you want a white contour with white labels?
Thanks for the answer, but I'd worked that out already. This doesn't give you a contour label that is equivalent to the original command clabel(cs,h,'Color','w'). It appears you can have either: 1) A white contour with a black label, neatly in line with the contour, but hard to read because it's black. 2) A white contour with a white label, but now the label is not inline with the contour but sticks out at a jaunty angle, again making it hard to read since it now crosses other contours in parts of the plot (depending on the plot in question - this affects many many scripts).
How do you get to the situation that worked perfectly well before: a neat white label, in line with a neat white contour. Or has this rather useful functionality just vanished ?

2 Comments

Yes, I had this issue as well for version 2015a. I upgraded to 2015b and the name,value arguments work as I want them to (contour labels in line w/ modifiable features)
This issue was fixed in MATLAB R2015b. You can download patches for MATLAB R2014b and R2015a. For more information check the Bug Report

Sign in to comment.

Categories

Asked:

on 24 Jul 2015

Commented:

on 16 Feb 2016

Community Treasure Hunt

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

Start Hunting!