matplotlib作图

import numpy as np
import matplotlib.pyplot as plt
a= np.arange(0,3*np.pi,0.5)
b= np.sin(a)
plt.plot(a,b)
plt.show()


一般容易出现import matplotlib as plt的误写导致

AttributeError: module ‘matplotlib‘ has no attribute ‘plot‘


又或者出现vars() argument must have __dict__ attribute的问题
这个一般解决方案是打开pycharm的setting->tool->python scientific->取消勾线show plots in tool window->apply->ok即可

posted @ 2023-03-05 00:00  天凉好个秋2022  阅读(50)  评论(0)    收藏  举报