PythonAnywhere Forums

Does anyone has problem show graph in ipython notebook?

I have a simple program below.

import matplotlib.pyplot as plt
import numpy as np
y = 2*X

It seems that the does not do anything. I am inside a ipython notebook and it used to work ok. Any help will be appreciated.



You should remove the '' line, as it won't do anything in the PythonAnywhere server environment.

Is the file 'graph.png' being created? If so, you just need to view it in your browser, see for example



Yes. The graph.png is created but can the graph show inline under the ipython notebook?

No, I don't think so - perhaps someone else can confirm?

Actually, with IPython notebooks it should be possible to show graphs -- just not in regular Python/IPython consoles. I think the thing you're missing is that you need to put this at in the very first cell of the notebook:

%matplotlib inline

Yes. It works. Many thanks for your help.

Great! Thanks for confirming.