how to avoid clabel overlap

조회 수: 29 (최근 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 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