bobsacameno
bobsacameno

Reputation: 765

Running python on Sage keeps getting stuck - not showing image

I'm trying to run sage in python mode. (The reason I don't run Jupyter is that it doesn't run on my machine - I don't know why. see question). But it keeps getting stuck all the time. For example, I try to run this code:

img_1=np.random.poisson(lam=300,size=(1024,1024))
img_1=img_1-img_1.mean()
plt.figure(figsize=(6,6))
plt.imshow(img_1)
plt.title("wowo")
plt.show()

But the image is not showing.

Upvotes: 0

Views: 94

Answers (1)

kcrisman
kcrisman

Reputation: 4402

Just add

plt.savefig('')

and it should show fine. Sage notebook needs the figure to be saved in a local directory for the cell, and this is one way to accomplish that.

Upvotes: 1

Related Questions