IPython embedded charts

Sep 22, 2013 at 3:24 PM
When I am running the Interactive Window with IPython every time I enter a plot() command a chart appears immediately. Is there a way to tell IPython under PTVS to only display a chart when I tell it to, using draw() or show()? I want to add several lines to a chart but cannot do it the way IPython is configured. I tried usind IPython without PyLab and importing matplotlib and also the command ioff() but nothing worked.

Thanks for any suggestions.
Sep 22, 2013 at 3:48 PM
Just to clarify, using IPython without PyLab the chart only shows after one calls plt.show(). But it is not embedded.
Sep 22, 2013 at 8:09 PM
Edited Sep 22, 2013 at 8:09 PM
soldalma, which version are you using? RC? we try to emulate the behavior of the Qt version of IPython. can you paste some specific commands in both PTVS RC + latest IPython vs IPython/Qtconsole to illustrate the difference? we can then look at how we can modify the REPL/handshake w the IPython backend. beyond that, we hand the commands to IPython & it hands us back a png.

some examples in our docs: https://pytools.codeplex.com/wikipage?title=Using%20IPython%20with%20PTVS
Sep 22, 2013 at 10:28 PM
Ok, I figured it out. The code I was running is quite simple:

import pandas as pd
import numpy as np
arr = np.array(range(20)).reshape(10,2)
df=pd.DataFrame(arr, columns = ['A', 'B'])

When I type the command

df.A.plot() <ENTER>

an embedded chart appears immediately in the Interactive Window. Then I type

df.B.plot() <ENTER>

and a second chart appears in the interactive window. I wanted both lines to appear in the same window.

I just found out that the way to do this is to type

df.A.plot() <SHIFT+ENTER>

and then type

df.B.plot() <ENTER>

Proceeding this way the two lines will appear in the same chart.
Sep 22, 2013 at 10:43 PM
that's correct - they're processed as a 'chunk'.

you can get the same effect by selected a number of lines in the Editor, then typing Ctrl-E-E, which will send it to IPython.

note that in general if you want to do more interactive plotting, you want to be in Pylab mode.