[IPython-User] IPy Notebook: Continue plotting in the same figure from another cell

Chao YUE chaoyuejoy@gmail....
Thu Jan 10 02:48:01 CST 2013


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 <chaoyuejoy@gmail.com> 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 <
> bussonniermatthias@gmail.com> 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" <lasse@norfeldt.dk> 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
>>> IPython-User@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>>
>>
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> 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
************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130110/a561b4ab/attachment-0001.html 


More information about the IPython-User mailing list