How to insert Bold text in to image??
Afficher commentaires plus anciens
I find that the current function 'insertText' doesn't support to insert Bold type or Italics type text.
How can I choose to insert Bold or not Bold text ?
4 commentaires
Stijn Haenen
le 20 Juin 2020
You can do this with:
figure1 = figure;
annotation(figure1,'textbox',[0.1 0.5 0.1 0.06],'String',{'test'},'FontWeight','bold');
Adam Danz
le 20 Juin 2020
annotation() uses normalized coordinates which is sometimes helpful. But if the text should be placed at specific loctations in data coordinates (or pixel coordinates), use text().
text(x,y,'MyText','FontWeight','Bold')
See the documentation for the text function to learn how to center it and change other properties.
桐 唐
le 20 Juin 2020
Adam Danz
le 20 Juin 2020
I see the problem now.
I haven't tried this but perhaps you could use the text or annotation function and save the figure as an image. It seems to be that there should be a better solution but I'm not aware of it at this time.
Réponses (1)
Nick
le 14 Août 2025
Déplacé(e) : Walter Roberson
le 14 Août 2025
0 votes
insertText doesn't have a "FontWeight" property like other functions, but it does allow you to specify bold/italic through the "Font" option. For example, to insert bold text with Courier New, you would specify "Font", "Courier New Bold". I'm not sure if it would work for all fonts, though!
Catégories
En savoir plus sur Configure and View Diagnostics dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!