필터 지우기
필터 지우기

How does the contour plot with R2014b work?

조회 수: 1 (최근 30일)
Janne
Janne 2014년 11월 25일
댓글: Mike Garrity 2015년 8월 20일
Hi there,
I have a script which worked perfectly in the version R2014a and now I have some issues. First, my legend displays the wrong colours for the contour plot and secondly, I cannot change the clabel properties. This is a simplified Code without the Clabel properties:
>> contour(MVD_cal,'Color','r')
>> hold on
>> contour(LWC_cal,'Color','b')
>> legend('MVD','LWC')
The plot itself is correct, but the legend displays both times Purple, Green and Yellow (See image at the buttom). How do I have to change the Code to get also a red and a blue indication in the legend??
To the second problem: I understand, that clabel works different now. I have the following code:
clabel( C_LWC,h_LWC ,'LabelSpacing',250);
clabel( C_LWC ,'color','w',...
'BackgroundColor',[0.2157 0 0.3207],...
'Edgecolor',aafPlotLineColor(1,:),...
'FontName', strFontName, ...
'FontUnit', strFontUnit, ...
'FontSize', iFontSize*0.8, ...
'FontWeight', strFontWeight, ...
'Interpreter', strInterpreter);
I would like to have the format of the second part (so the box, the color, the style), but on the position and also following the graph like in the first part (LabelSpacing). How do I do that now, that I have to use C_LWC,h_LWC for LabelSpacing and only C_LWC for the formating?
Thanks a lot!
Janne

답변 (1개)

Rob Comer
Rob Comer 2015년 6월 5일
You can avoid the problem with the clabel function, which is present in both R2014b and R2015a, by using one of the workarounds available here: http://www.mathworks.com/support/bugreports/1114747. After downloading and installing the appropriate workaround, you will be able to control the appearance of contour label text with commands such as this:
[C,h] = contour(peaks);
clabel(C,h,'BackgroundColor','yellow','EdgeColor','magenta', ...
'FontName','helvetica','FontSize',20,'FontWeight','bold',...
'Interpreter','latex')
The workaround will enable you to specify 12 properties that affect the appearance of contour labels. This includes all the properties shown in your code above, except for FontUnits. (Instead of setting FontUnits, you'll need to set the value of FontSize in units of 'points'.)
  댓글 수: 2
Jason
Jason 2015년 8월 20일
you didn't respond to the original question on why in 2014b contour plot color in the legend is wrong. Why?
Mike Garrity
Mike Garrity 2015년 8월 20일
We've been fiddling with how legend represents contours to try to make it better, but the new version certainly didn't do very well in this case. Could you send this to the support team to make sure they know about it. I don't think I've seen a bug report for this one.

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

카테고리

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