Azzera filtri
Azzera filtri

When I save a figure to a file (saveas , hgexport) the figure is re-sized. How do I save a figure to a file that is identical to the screen figure (i.e. not resized)? Why isn't this the default for saving figures?

1 visualizzazione (ultimi 30 giorni)
I have changed the figure size using:
figure('OuterPosition',[1 1 scrsz(3)/1.1 scrsz(4)/1.1]);
When I attempt to save the figure to a file (png, bmp, jpg) using saveas or hgexport, the figure size is resized back to default. How do I avoid this?
Using the figure window menu bar and edit>copy figure copies the screen figure to the clipboard without re-sizing. Why isn't this easy to do with Matlab commands?

Risposta accettata

Walter Roberson
Walter Roberson il 20 Lug 2015
You probably need to look at the figure PrintPosition and PrintPositionMode properties.
  2 Commenti
David
David il 21 Lug 2015
What I am trying to do is very simple -- just save the figure exactly as it is drawn on the screen, just like the GUI-copy-figure command does. It seems to me like the answer should be equally simple. I have looked at the print command and it appears that there are several variables that control scaling, position and resolution. I'm still hoping that there is a simple answer.
David
David il 21 Lug 2015
I did search the help database for paper Position Mode and I found the following. This does solve the problem. Thanks for your help.
set(gcf,'PaperPositionMode','auto') % Use screen size

Accedi per commentare.

Più risposte (1)

Allen Goldstein
Allen Goldstein il 21 Gen 2021
You need to change the Resolution in the factorystyle to 0:
style = hgexport('factorystyle'); % get the style
style.Resolution = 0; % Resolution = 0 meanst use the screen resolution
hgexport(data,'-clipboard',style);

Categorie

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

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by