Thread Subject: save figure by script

Subject: save figure by script

From: Avri Alony

Date: 17 Aug, 2011 05:58:33

Message: 1 of 3

saving figure of scatter(X,Y,250,M,'filled') my manual (File - Save as
- filename.tif (TIFF no compression image)) generate exactly the same
image as in figure.

saving the figure by script: saveas(gca,'filename.tiff','tiff'); gave
different image compare to original figure, for example - the dot-size
change to be smaller.

How to save by script and keep the image to be exactly as the original
figure ?

Subject: save figure by script

From: Grzegorz Knor

Date: 17 Aug, 2011 06:38:09

Message: 2 of 3

Avri Alony <avrialony@gmail.com> wrote in message <b4531394-b3a3-4420-a1d8-fbbda2f34c2e@m38g2000vbn.googlegroups.com>...
> saving figure of scatter(X,Y,250,M,'filled') my manual (File - Save as
> - filename.tif (TIFF no compression image)) generate exactly the same
> image as in figure.
>
> saving the figure by script: saveas(gca,'filename.tiff','tiff'); gave
> different image compare to original figure, for example - the dot-size
> change to be smaller.
>
> How to save by script and keep the image to be exactly as the original
> figure ?

Try this code:

function screen2tiff(fig,filename)
oldscreenunits = get(fig,'Units');
oldpaperunits = get(fig,'PaperUnits');
oldpaperpos = get(fig,'PaperPosition');
set(fig,'Units','pixels');
scrpos = get(fig,'Position');
newpos = scrpos/100;
set(fig,'PaperUnits','inches',...
'PaperPosition',newpos)
print('-dtiffn', filename, '-r100');
drawnow
set(fig,'Units',oldscreenunits,...
'PaperUnits',oldpaperunits,...
'PaperPosition',oldpaperpos)

source:
http://www.mathworks.com/support/solutions/en/data/1-16WME/?solution=1-16WME

Grzegorz

Subject: save figure by script

From: Oliver Woodford

Date: 17 Aug, 2011 13:00:12

Message: 3 of 3

Avri Alony wrote:
> saving figure of scatter(X,Y,250,M,'filled') my manual (File - Save as
> - filename.tif (TIFF no compression image)) generate exactly the same
> image as in figure.
>
> saving the figure by script: saveas(gca,'filename.tiff','tiff'); gave
> different image compare to original figure, for example - the dot-size
> change to be smaller.
>
> How to save by script and keep the image to be exactly as the original
> figure ?

See:
http://sites.google.com/site/oliverwoodford/software/export_fig

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com