简体   繁体   中英

how to use Pyplot module of matplotlib to plot two arrays of data

I wrote this code: I wrote this code: I am trying to plot the two arrays x "the data number" and y "the data itself"

for t in range(1, 281):
    data[t] = (3600 + (240 + t * 4) + 281)

for r in range(1, 281):
    sn[r] = r
x = np.array(sn[r])
y = np.array(data[t])
plt.plot(x, y)

where is the problem

After plotting the data with plt.plot(x,y) you need to show the plot with plt.show() . Alternatively you can save the plot directly to disk with plt.savefig("Myfile.png",format="png") .

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