フィルターのクリア

how to avoid clabel overlap

30 ビュー (過去 30 日間)
Jing Sun
Jing Sun 2017 年 1 月 17 日
コメント済み: Jing Sun 2017 年 1 月 21 日
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

回答 (1 件)

Chinmayi Lanka
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
  1 件のコメント
Jing Sun
Jing Sun 2017 年 1 月 21 日
because I draw several pictures together, so manual is not possible. And I had tried the labelspacing, there still will be some overlaps. Is there any other way?

サインインしてコメントする。

カテゴリ

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