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 Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by