Reputation: 89
I have successfully plotted two graphs, but when I plot the third, I get an invalid syntax error. Am I missing something super obvious?
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()
When I comment out graph 3, the others graph just fine. When I try to plot graph 3, I get the following error:
ax.scatter(x2, mx2, s=10)
SyntaxError: invalid syntax
Upvotes: 1
Views: 3254
Reputation: 5696
#plot 3
fig, ax = plt.subplots(1, figsize=(6,6))
Close the parantheses :)
Upvotes: 3