How do I change the font size of city names on a map that has already been created?

3 次查看(过去 30 天)

采纳的回答

MathWorks Support Team
Text objects on a map are the same as any other text object. You can change the fontsize of the text object once you have the object handle using the SET function.
The following method extracts all text objects in the current figure that have a non-empty string, and changes their fontsize:
figure; axesm miller
framem('FEdgeColor','red')
textm(60,90,'hello')
textm(50,90,'hello')
textm(40,90,'hello')
textm(30,90,'hello')
h = findall(gca, 'type', 'text');
h_string = get(h, 'string');
index = find(~strcmp(h_string, ''))
h_new = h(index);
set(h_new, 'fontsize', 17)
Note: this may also change the fontsize of axis labels if they already contain strings. The XLABEL, YLABEL, and ZLABEL are text objects which are children of the axes.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Labels and Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by