Borrar filtros
Borrar filtros

how to avoid clabel overlap

30 visualizaciones (últimos 30 días)
Jing Sun
Jing Sun el 17 de En. de 2017
Comentada: Jing Sun el 21 de En. de 2017
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

Respuestas (1)

Chinmayi Lanka
Chinmayi Lanka el 19 de En. de 2017
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 comentario
Jing Sun
Jing Sun el 21 de En. de 2017
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?

Iniciar sesión para comentar.

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by