SO I have recently started trying to use ipython, I am finding I cannot get it to produce an output graph. I am running the following code in ipython:

from sklearn import linear_model
regr = linear_model.LinearRegression()

regr.fit(x, y)
pl.plot(x, y, 'o')
pl.plot(x_test, regr.predict(x_test))

and I am recieving the output:

[<matplotlib.lines.Line2D at 0x21d453b0>]

With no image attatched.

I installed ipython using the pythonxy package. Any thoughts of suggestions on methods to get plots outputting correctly in ipython

See attached image:
enter image description here

有帮助吗?

解决方案

Try running in a cell:

%pylab inline    # or
%matplotlib inline

After that the plots should be displayed inline. Alternatively start the notebook using the inline option in the command line:

ipython notebook --pylab=inline

其他提示

from IPython.display import display
from IPython.display import Image

# your code here

Image(data=<your_image_data_here>, embed=True)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top