简体   繁体   中英

Matplotlib plot window is black

I recently started studying python and matplotlib. The problem I face is that I always get a black window as a plot output.

See simple code below.

import numpy as np
import matplotlib.pyplot as plt
import pylab


x = np.arange(0, 5, 0.1)
y = np.sin(x)

#plot the x and y and you are supposed to see a sine curve
plt.plot(x, y)

pylab.show()

截图

I get the same result executing code samples from matplotlib pages. Does anyone have any idea where this comes from and how to overcome this?

I'm using the Operating system Linux Mint.

I executed code in python shell and it works, the problem comes executing code in python editors. I worked with two different editors.

在此输入图像描述

Best regards

Robert

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM