Is it possible to make figure caption?

25 vues (au cours des 30 derniers jours)
Mr M.
Mr M. le 19 Mai 2015
Commenté : Image Analyst le 1 Avr 2021
I would like to save my plot as a png image but with text caption under it. I would like to make a big paragraph caption with the same width as the whole figure. Is it possible to make it under MATLAB?

Réponses (2)

Image Analyst
Image Analyst le 19 Mai 2015
One way is to stitch some blank lines onto the bottom of the image, then
  1. use text() to write stuff into the overlay and use export_fig() to save the axes as an image, or
  2. use the textInserter of the Computer Vision System Toolbox to burn text directly into the image and then save the image with imwrite().
  1 commentaire
Star Strider
Star Strider le 19 Mai 2015
the annotation('textbox',[x y w h]) function is another option. See the Annotation documentation for details.

Connectez-vous pour commenter.


Scott MacKenzie
Scott MacKenzie le 1 Avr 2021
Modifié(e) : Scott MacKenzie le 1 Avr 2021
To elaborated on Image Analyst's "stitch some blank lines", here's what worked for me. For the x-axis label, use something like this:
ax = gca;
ax.XLabel.String = sprintf('X Axis Label\n\n\n\n');
The newline characters create some additional empty space below the figure. Then use the text function to add your caption in that space.
  1 commentaire
Image Analyst
Image Analyst le 1 Avr 2021
Yes, and then he can use exportgraphics() (in r2020a and later) to save the axes or figure to disk.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Printing and Saving dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by