[IPython-User] IPy Notebook: Continue plotting in the same figure from another cell
Norfeldt
lasse@norfeldt...
Thu Jan 10 07:16:59 CST 2013
Thank you both for your helpful answer :)
I was using the IPy inline (such neat and useful feature)
Matthias:
The autoclose must do more than just closing the figure - it must do
fig.clf()
The OO way is useful and reminds me that I always forget that it is the
axes that contain the plot goodies and not the figure.
(to me it would be more obvious to call figure -> window and axes -> plot -
but that's just my world)
I will try to disable the autoclose next time..
Chao:
I like your way of doing it - but then I would need to know the magic
command for plotting inline
On Thu, Jan 10, 2013 at 9:48 AM, Chao [via Python] <
ml-node+s6n5001916h82@n6.nabble.com> wrote:
> and
>
> ychao@lsce3139:~$ ipython notebook --pylab
>
> will enable you to do in the first cell:
>
> plot(np.arange(10))
>
> and the second:
> xlabel('I am xlabel')
>
> after the second, the figure will be updated.
>
> Chao
>
>
> On Thu, Jan 10, 2013 at 9:45 AM, Chao YUE <[hidden email]<http://user/SendEmail.jtp?type=node&node=5001916&i=0>
> > wrote:
>
>> I think if you're using notebook with inline mode, maybe currently it
>> doesn't suport interactive plotting.
>>
>> if you can succeed with the same code in ipython --pylab without
>> notebook, then it's what as
>> I indicate. I think ipython --pylab will enable you to do what you want
>> even without using OO
>> interface.
>>
>> chao
>>
>>
>>
>> On Thu, Jan 10, 2013 at 9:25 AM, Matthias Bussonnier <[hidden email]<http://user/SendEmail.jtp?type=node&node=5001916&i=1>
>> > wrote:
>>
>>> Short from my phone.
>>>
>>> There is an autoclose option on profile/command line see --help-all
>>> Set it to false.
>>>
>>> Or the preferable way. Use matplotlib OO interface:
>>>
>>> Fig,ax =subplots(1,1)
>>> ax.plot(...)
>>>
>>> Markdown
>>>
>>> ax.dosomethingelse(...)
>>>
>>> Which is the real way of using matplotlib without pylab magic. It is
>>> much more powerfull.
>>> --
>>> Matthias
>>> Le 10 janv. 2013 09:09, "Norfeldt" <[hidden email]<http://user/SendEmail.jtp?type=node&node=5001916&i=2>>
>>> a écrit :
>>>
>>> This is properly a trivial question and due to my lack of experience with
>>>> matplotlib (come from a MATLAB environment) :
>>>>
>>>> Here is an illustration of my question:
>>>>
>>>> --Cell 1----------------------------------
>>>> fig = figure(1)
>>>> fig.clf()
>>>>
>>>> count, bars, ignored = hist(very_very_big_population, 40, normed=True)
>>>> plot(bars, bell_curve_data(bars), color='r')
>>>> -------------------------------------------
>>>>
>>>> -- Markup cell ----------------------
>>>> Some text explaining what I want to do next or other stuff.
>>>> -------------------------------------------
>>>>
>>>> --Cell 2--------------------------------
>>>> fig # continue plotting on the previous figure
>>>>
>>>> plot(bars, some_other_data, color='g')
>>>> ------------------------------------------
>>>>
>>>> However I can't seem to continue plotting on the same figure and have
>>>> to run
>>>> the hist and plot again - which takes time since it is really a big big
>>>> population...
>>>>
>>>> How do I continue plotting on the figure from the previous cell (Cell 1)
>>>> ________________________?
>>>>
>>>>
>>>> BONUS QUESTION:
>>>>
>>>> While typing this I quickly started thinking if it is possible to copy
>>>> the
>>>> figure with plot ____________________?
>>>> So say I want to plot something in Cell 2 on the the figure from Cell 1
>>>> but
>>>> still want to be able to get a "clean" (without the Cell 2 plotting)
>>>> Cell 1
>>>> figure in Cell 3 and do some different plotting on this.
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://python.6.n6.nabble.com/IPy-Notebook-Continue-plotting-in-the-same-figure-from-another-cell-tp5001910.html
>>>> Sent from the IPython - User mailing list archive at Nabble.com.
>>>> _______________________________________________
>>>> IPython-User mailing list
>>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=5001916&i=3>
>>>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>>>
>>>
>>> _______________________________________________
>>> IPython-User mailing list
>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=5001916&i=4>
>>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>>
>>>
>>
>>
>> --
>>
>> ***********************************************************************************
>> Chao YUE
>> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
>> UMR 1572 CEA-CNRS-UVSQ
>> Batiment 712 - Pe 119
>> 91191 GIF Sur YVETTE Cedex
>> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
>>
>> ************************************************************************************
>>
>
>
>
> --
>
> ***********************************************************************************
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
>
> ************************************************************************************
>
> _______________________________________________
> IPython-User mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5001916&i=5>
> http://mail.scipy.org/mailman/listinfo/ipython-user
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://python.6.n6.nabble.com/IPy-Notebook-Continue-plotting-in-the-same-figure-from-another-cell-tp5001910p5001916.html
> To unsubscribe from IPy Notebook: Continue plotting in the same figure
> from another cell, click here<http://python.6.n6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5001910&code=bGFzc2VAbm9yZmVsZHQuZGt8NTAwMTkxMHwtMTIzMjkyOTYyOQ==>
> .
> NAML<http://python.6.n6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://python.6.n6.nabble.com/IPy-Notebook-Continue-plotting-in-the-same-figure-from-another-cell-tp5001910p5001932.html
Sent from the IPython - User mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130110/00b31e36/attachment.html
More information about the IPython-User
mailing list