Export a plot with predefined margins

18 visualizzazioni (ultimi 30 giorni)
Leon il 28 Ago 2021
Commentato: Leon il 29 Ago 2021
I'm using the below command to export my plot into a jpeg file:
% h is the handle for the figure
% File_W is my jpeg file name
exportgraphics(h, File_W, 'Resolution', 600);
It works well except one issue. The system will automatically crop the figure to the smallest possible without losing any information. However, that's not what I want.
Is there a way I could add a predefined margin/gap, e.g., 20 pixels to the top, bottom, left and right?
Many thanks.

Risposta accettata

TADA il 28 Ago 2021
Modificato: TADA il 28 Ago 2021
theres the old school print function, still works well
print(h, File_W, format, '-r600');
for instance, if you want to export as .tif file:
print(h, File_W, '-dtiff', '-r600');
  3 Commenti
Leon il 29 Ago 2021
Many thanks!
I'll purchase the Imagine Processing toolbox and try it out later.

Accedi per commentare.

Più risposte (0)


Scopri di più su Printing and Saving in Help Center e File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by