saving a PNg jsut as dispalyed

Hi all,

I want to save a figure just like it is displayed i.e. the same dpi (wxAgg). However, the default Figure.savefig uses a different dpi setting than the figure as displayed, so I'm doing:

dpi = Fig.get_dpi()
Fig.savefig(str(path), dpi=dpi)

which seems to work, but seems more awkward than it should be. Is there a flag or something I'm missing?

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

I think this line in the rc file is the trick

#savefig.dpi : 100

···

On Wed, Mar 26, 2008 at 6:16 PM, Christopher Barker <Chris.Barker@...259...> wrote:

Hi all,

I want to save a figure just like it is displayed i.e. the same dpi
(wxAgg). However, the default Figure.savefig uses a different dpi
setting than the figure as displayed, so I'm doing:

dpi = Fig.get_dpi()
Fig.savefig(str(path), dpi=dpi)

which seems to work, but seems more awkward than it should be. Is there
a flag or something I'm missing?

-Chris

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Ryan Krauss wrote:

I think this line in the rc file is the trick

#savefig.dpi : 100

nope. I think all that does is set the default dpi for savefig. I don't want any default, I want it to use the same dpi that is being used for display, and I don't know ahead of time what that is, I expect it is system dependent.

Or do you mean that if I comment out that line, it will default to the one already in use? In which case, I need to go figure out how to change that in code, rather than messing with my matplotlibrc.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

I guess you could read the rcParams value that corresponds to the
screen display and set rcParams['savefig.dpi'] to that value (this
might work):

mydpi = rcParams['figure.dpi']
rcParams['savefig.dpi'] = mydpi

But that seems slightly hackish and maybe not much more elegant than
what you are currently doing with passing dpi into savefig.

FWIW,

Ryan

···

On Thu, Mar 27, 2008 at 1:57 PM, Christopher Barker <Chris.Barker@...259...> wrote:

Ryan Krauss wrote:
> I think this line in the rc file is the trick
>
> #savefig.dpi : 100

nope. I think all that does is set the default dpi for savefig. I don't
want any default, I want it to use the same dpi that is being used for
display, and I don't know ahead of time what that is, I expect it is
system dependent.

Or do you mean that if I comment out that line, it will default to the
one already in use? In which case, I need to go figure out how to change
that in code, rather than messing with my matplotlibrc.

-Chris

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options