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

조회 수: 4 (최근 30일)
Lucy MacGregor
Lucy MacGregor 2015년 7월 24일
댓글: Benjamin Kraus 2016년 2월 16일
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.

답변 (2개)

Benjamin Kraus
Benjamin Kraus 2015년 7월 24일
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?

Lucy MacGregor
Lucy MacGregor 2015년 7월 27일
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
GK
GK 2015년 10월 6일
편집: GK 2015년 10월 7일
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)
Benjamin Kraus
Benjamin Kraus 2016년 2월 16일
This issue was fixed in MATLAB R2015b. You can download patches for MATLAB R2014b and R2015a. For more information check the Bug Report

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by