我已经成功地绘制了两个图,但是当我绘制第三个图时,我得到了一个无效的语法错误。我错过了什么超明显的东西吗?
x=df['time']
d=df['dist']
x2=df2['time']
d2=df2['dist']
p2=df2['pressure']
mx2=df2['magx']
#plot 1
fig, ax = plt.subplots(2, figsize=(6,6))
ax[0].scatter(x,d,s=10)
ax[1].scatter(x2, d2, s=10)
#plot 2
fig, ax = plt.subplots(1, figsize=(6,6))
ax.scatter(x2,p2,s=10)
#plot 3
fig, ax = plt.subplots(1, figsize=(6,6)
ax.scatter(x2, mx2, s=10)
fig.show()当我注释掉图3时,其他的图就很好了。当我试图绘制图3时,我会得到以下错误:
ax.scatter(x2, mx2, s=10)
SyntaxError: invalid syntax发布于 2017-10-11 05:09:07
#plot 3
fig, ax = plt.subplots(1, figsize=(6,6))关闭parantheses :)
https://stackoverflow.com/questions/46680148
复制相似问题