How do I change the font size of city names on a map that has already been created?
4 views (last 30 days)
Show older comments
I would like to enlarge the font of the city names displayed on a map that has already been created.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
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 Comments
More Answers (0)
See Also
Categories
Find more on Labels and Annotations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!