0

I have the following code which is regular for anyone who would like to make a plot with pandas in IPython.

In [1]: import pandas as pd
In [2]: import numpy as np
In [3]: import matplotlib.pyplot as plt
In [4]: %matplotlib inline

Here it pops up an error:

UsageError: Invalid GUI request u'inline', valid ones are: pyglet, osx, qt5, qt, glut, gtk, gtk3, tk, wx

I read this post Run python script in IPython with inline / embedded plots

and found the two methods to get around:

ipython qtconsole --matplotlib inline -m example_plots

or

ipython qtconsole --pylab inline -m example_plots

But none of them works in my situation (I actually got stuck in iPython without making a plot, needless to say a plot embedded within a script.)

I am not sure where went wrong as %matplotlib inline used to work. I am using python 2.7.11 and IPython 4.2.0 if this information helps.

Thank you very much for your help.

3
  • Try %matplotlib inline before importing pyplot. Commented Jul 11, 2016 at 14:22
  • perhaps you might want to run the code in a notebook? Or is that not an option? Commented Jul 11, 2016 at 14:23
  • M.T.'s suggestion works. IPython Notebook does the work. Thank you both! Commented Jul 11, 2016 at 18:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.