Question

I'm new to PythonXY and Matplotlib. I installed PythonXY (v2.7.3.1) in default full mode.

PythonXY

I use the "IPython Qt Console" application.

IPython Qt Console

I draw something using matplotlib.pyplot (imported as plt). For example. When plt.plot([1,3,2,4]), the figure display in the same IPython console immediately.

plt.plot

If this, I cannot add some other properties, plt.title, plt.xlabel, plt.ylabel, or more. Why? And how can I draw figures in another window, adding more properties, and making the figure not display until plt.show()?

Was it helpful?

Solution

If you select from the Interactive Consoles dropdown on the Python(x,y) Home launcher, "IPython (Qt)" and then click either the Console 2 or cmd.exe button, it should then run IPython (Qt) with the Qt4Agg backend which will allow you to plot in a separate window and apply titles and so on. For more info see What is a backend.

What Python(x,y) in your example above is doing is launching IPython with the pylab inline backend which is different from the standard backends so your commands aren't having any affect, similar behaviour is noted in this issue on github. It doesn't seem possible to change the backend once IPython has been launched with inline. I'm not sure where the Python(x,y) options are set or which script is called to launch the item in the Applications dropdown.

Worth taking a look at Anaconda as a free Python distribution with a scientific focus and regular updates. Anaconda doesn't by default load pylab into IPython so you can choose the backend after launching IPython.

OTHER TIPS

  1. In the IPython command-line interface, the figure is shown and updated at each plot function.
  2. With the inline option, Matplotlib generates an image that automatically inserted in the output line.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top