参考如下实例:
# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import setp [as 别名]
def plotTimeShareChart(self, code, date, n):
date = self._daysEngine.codeTDayOffset(code, date, n)
if date is None: return
DyMatplotlib.newFig()
# plot stock time share chart
self._plotTimeShareChart(code, date, left=0.05, right=0.95, top=0.95, bottom=0.05)
# plot index time share chart
#self._plotTimeShareChart(self._daysEngine.getIndex(code), date, left=0.05, right=0.95, top=0.45, bottom=0.05)
# layout
f = plt.gcf()
plt.setp([a.get_xticklabels() for a in f.axes[::2]], visible=False)
f.show()
修改你这个.py文件名重新运行一下!
文件名不要取plotting
1、你的文件名和库函数名重复了,建议改文件名
2、路径你可以用绝对路径(针对本机)
3、逻辑运算符比较建议用crop is True (==运行不会报错,但pycharm会提示错误)
你的py文件名称和你要导入的模块名称产生重复了,
引入时导致pycharm 读取错误,你可以先将你的py文件改个名字,重新运行哈
修改文件名,不要与plotting库重名
你自己的文件不要起名叫plotting.py,换一个自己的名字,比如myplot之类的,和库文件区分开