savefig

Dear experts,
I start ipython in ipython qtconsole --pylab=inline mode and make a plot. But if I use savefig('fig.png') the figure do not get saved instead I get a blank page.

I also tried img.save('fig.png',png) but no use. Is there a way out or I need to do this after quitting and restarting in normal mode each time I want to save?

ipython qtconsole --pylab=inline

In [93]: ts.plot()
Out[93]: <matplotlib.axes.AxesSubplot at 0x9135490>

···

***************************************************************
Sudheer Joseph
Indian National Centre for Ocean Information Services
Ministry of Earth Sciences, Govt. of India
POST BOX NO: 21, IDA Jeedeemetla P.O.
Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
E-mail:sjo.India@...287...;sudheer.joseph@...9...
Web- http://oppamthadathil.tripod.com
***************************************************************

The fig is destroyed after it has been displayed by the console. Try saving
it before it gets shown.
-p

···

On Wed, Jun 12, 2013 at 10:28 PM, Sudheer Joseph <sudheer.joseph@...9...>wrote:

Dear experts,
I start ipython in ipython qtconsole --pylab=inline mode and make a plot.
But if I use savefig('fig.png') the figure do not get saved instead I get a
blank page.

I also tried img.save('fig.png',png) but no use. Is there a way out or I
need to do this after quitting and restarting in normal mode each time I
want to save?

ipython qtconsole --pylab=inline

In [93]: ts.plot()
Out[93]: <matplotlib.axes.AxesSubplot at 0x9135490>

Thank you,
I don’t see a way other than starting in normal mode as the moment I type plot command it get displayed and I don’t need to do a show command.
With best regards sudheer

···

On Wed, Jun 12, 2013 at 10:28 PM, Sudheer Joseph <sudheer.joseph@…9…> wrote:

Dear experts,

I start ipython in ipython qtconsole --pylab=inline mode and make a plot. But if I use savefig(‘fig.png’) the figure do not get saved instead I get a blank page.

I also tried img.save(‘fig.png’,png) but no use. Is there a way out or I need to do this after quitting and restarting in normal mode each time I want to save?

ipython qtconsole --pylab=inline

In [93]: ts.plot()

Out[93]: <matplotlib.axes.AxesSubplot at 0x9135490>

The fig is destroyed after it has been displayed by the console. Try saving it before it gets shown.

-p

savefig works for me when I put both the plotting commands and the savefig call in the same code cell.

···

On Thu, Jun 13, 2013 at 10:31 AM, Sudheer Joseph <sudheer.joseph@…9…> wrote:

Thank you,
I don’t see a way other than starting in normal mode as the moment I type plot command it get displayed and I don’t need to do a show command.

With best regards sudheer


**From:
**
Paul Hobson <pmhobson@…287…>;
**To:
**
Sudheer Joseph <sudheer.joseph@…9…>;
**Cc:
**
matplotlib-users@lists.sourceforge.net matplotlib-users@lists.sourceforge.net;
**Subject:
**
Re: [Matplotlib-users] savefig
**Sent:
**
Thu, Jun 13, 2013 2:23:05 PM


This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

On Wed, Jun 12, 2013 at 10:28 PM, Sudheer Joseph <sudheer.joseph@…9…> wrote:

Dear experts,

I start ipython in ipython qtconsole --pylab=inline mode and make a plot. But if I use savefig(‘fig.png’) the figure do not get saved instead I get a blank page.

I also tried img.save(‘fig.png’,png) but no use. Is there a way out or I need to do this after quitting and restarting in normal mode each time I want to save?

ipython qtconsole --pylab=inline

In [93]: ts.plot()

Out[93]: <matplotlib.axes.AxesSubplot at 0x9135490>

The fig is destroyed after it has been displayed by the console. Try saving it before it gets shown.

-p

close_figures, not close_all

Haven't tried to switch it at run time using %config magic though.

$ ipython [qtconsole|notebook|whatever] --help-all

to get all option as examples in config files are **not** updated with IPython.

InlineBackend options

···

---------------------
--InlineBackend.close_figures=<CBool>
    Default: True
    Close all figures at the end of each cell.
    When True, ensures that each cell starts with no active figures, but it also
    means that one must keep track of references in order to edit or redraw
    figures in subsequent cells. This mode is ideal for the notebook, where
    residual plots from other cells might be surprising.
    When False, one must call figure() to create new figures. This means that
    gcf() and getfigs() can reference figures created in other cells, and the
    active figure can continue to be edited with pylab/pyplot methods that
    reference the current active figure. This mode facilitates iterative editing
    of figures, and behaves most consistently with other matplotlib backends,
    but figure barriers between cells must be explicit.

Thank you Roban,
Your that trick worked,
if I keep ts.plot(), savefig('ts.pdf') both on same line it works!

with best regards
Sudheer

···

***************************************************************
Sudheer Joseph
Indian National Centre for Ocean Information Services
Ministry of Earth Sciences, Govt. of India
POST BOX NO: 21, IDA Jeedeemetla P.O.
Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
E-mail:sjo.India@...287...;sudheer.joseph@...9...
Web- http://oppamthadathil.tripod.com
***************************************************************

________________________________
From: Roban Kramer <robanhk@...287...>
To: sudheer.joseph@...9...
Cc: Paul Hobson <pmhobson@...287...>; "matplotlib-users@...564...net" <matplotlib-users@lists.sourceforge.net>
Sent: Thursday, 13 June 2013 8:12 PM
Subject: Re: [Matplotlib-users] savefig

savefig works for me when I put both the plotting commands and the savefig call in the *same* code cell.

On Thu, Jun 13, 2013 at 10:31 AM, Sudheer Joseph <sudheer.joseph@...9...> wrote:

Thank you,

I don't see a way other than starting in normal mode as the moment I type plot command it get displayed and I don't need to do a show command.
With best regards sudheer

________________________________
From: Paul Hobson <pmhobson@...287...>;
To: Sudheer Joseph <sudheer.joseph@...9...>;
Cc: matplotlib-users@lists.sourceforge.net <matplotlib-users@...813...ourceforge.net>;
Subject: Re: [Matplotlib-users] savefig
Sent: Thu, Jun 13, 2013 2:23:05 PM

On Wed, Jun 12, 2013 at 10:28 PM, Sudheer Joseph <sudheer.joseph@...9...> wrote:

Dear experts,

I start ipython in ipython qtconsole --pylab=inline mode and make a plot. But if I use savefig('fig.png') the figure do not get saved instead I get a blank page.

I also tried img.save('fig.png',png) but no use. Is there a way out or I need to do this after quitting and restarting in normal mode each time I want to save?

ipython qtconsole --pylab=inline

In [93]: ts.plot()
Out[93]: <matplotlib.axes.AxesSubplot at 0x9135490>

The fig is destroyed after it has been displayed by the console. Try saving it before it gets shown.
-p
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Thank you,
I don’t see a way other than starting in normal mode as the moment I type plot command it get displayed and I don’t need to do a show command.
With best regards sudheer

···

On Wed, Jun 12, 2013 at 10:28 PM, Sudheer Joseph <sudheer.joseph@…9…> wrote:

Dear experts,

I start ipython in ipython qtconsole --pylab=inline mode and make a plot. But if I use savefig(‘fig.png’) the figure do not get saved instead I get a blank page.

I also tried img.save(‘fig.png’,png) but no use. Is there a way out or I need to do this after quitting and restarting in normal mode each time I want to save?

ipython qtconsole --pylab=inline

In [93]: ts.plot()

Out[93]: <matplotlib.axes.AxesSubplot at 0x9135490>

The fig is destroyed after it has been displayed by the console. Try saving it before it gets shown.

-p

In the qtconsole, you can enter multi-line mode with crtl+enter.

···

On Thu, Jun 13, 2013 at 11:40 PM, Sudheer Joseph <sudheer.joseph@...9...>wrote:

Thank you,
I don't see a way other than starting in normal mode as the moment I type
plot command it get displayed and I don't need to do a show command.

Thank you,
This is some thing new, which I learned.
with best regards,
Sudheer

···

Sudheer Joseph
Indian National Centre for Ocean Information Services
Ministry of Earth Sciences, Govt. of India
POST BOX NO: 21, IDA Jeedeemetla P.O.
Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
Tel:+91-40-23044600®,Tel:+91-40-9440832534(Mobile)
E-mail:sjo.India@…120…287…;sudheer.joseph@…9…
Web- http://oppamthadathil.tripod.com



From: Paul Hobson <pmhobson@…287…>
To: Sudheer Joseph <sudheer.joseph@…9…>
Cc: "matplotlib-users@lists.sourceforge.net" matplotlib-users@lists.sourceforge.net
Sent: Friday, 14 June 2013 9:05 PM
Subject: Re: [Matplotlib-users] savefig

On Thu, Jun 13, 2013 at 11:40 PM, Sudheer Joseph <sudheer.joseph@…9…> wrote:

Thank you,
I don’t see a way other than starting in normal mode as the moment I type plot command it get displayed and I don’t need to do a show command.

In the qtconsole, you can enter multi-line mode with crtl+enter.