how to avoid clabel overlap
29 次查看(过去 30 天)
显示 更早的评论
my matlab version is 2015a, when i want to use "clabel(c,h,'labelspacing',100,'fontsize',8);" , it doesn;t work. in the version after 2014, you can only use "clabel(c,'fontsize',8)" to adjust the clabel fontsize. But I don't want the the "+" symbol. How can I use the labelspacing and the fontsize at the same time? Or how to avoid overlap of the clabel, with smaller fontsize and large spacing. Thanks
0 个评论
回答(1 个)
Chinmayi Lanka
2017-1-19
The "clabel" function allows you to create contour labels and partially customize their appearance.
One approach could be to label the contour plot manually. The following command allows you to click on the plot and MATLAB creates labels at the selected position for the contour line under the mouse:
>> clabel(C,h,'manual')
Click the mouse or press the space bar to label the contour closest to the center of the crosshair. Press the Return key while the cursor is within the figure window to terminate labeling.
There are two possibilities to adjust the density of labels in the entire contour plot when using automatic labelling: 1) Label only a subset of the displayed contour lines:
>> [x,y,z] = peaks;
>> [C,h] = contour(x,y,z);
>> v = [-2 0 6 8]; %Label only the contours with contour levels -2, 0, 6 or 8
>> clabel(C,h,v)
2) Change the spacing between labels on one contour line:
>> [x,y,z] = peaks;
>> [C,h] = contour(x,y,z);
>> clabel(C,h,'LabelSpacing',100) % define space between labels, specified as a scalar value in point units
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!