How does the contour plot with R2014b work?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
Rob Comer
el 5 de Jun. de 2015
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 comentarios
Jason
el 20 de Ag. de 2015
you didn't respond to the original question on why in 2014b contour plot color in the legend is wrong. Why?
Mike Garrity
el 20 de Ag. de 2015
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.
Ver también
Categorías
Más información sobre Contour Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!