I can't understand why "ax=ax" meaning in matplotlib
<pre><code>from datetime import datetime
fig=plt.figure()
ax=fig.add_subplot(1,1,1)
data=pd.read_csv(r"C:\Users\champion\Desktop\ch02\spx.csv")
spx=data["SPX"]
spx.plot(**ax=ax**,style="k-")
</code></pre>

<p>I can't understand why "ax=ax" meaning in matplotlib.</p>

<p>From the documentation of <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.plot.html" rel="nofollow">plot()</a>:</p>

<blockquote>
  <p>DataFrame.plot(x=None, y=None, kind='line', ax=None, subplots=False,
  sharex=None, sharey=False, layout=None, figsize=None, use_index=True,
  title=None, grid=None, legend=True, style=None, logx=False,
  logy=False, loglog=False, xticks=None, yticks=None, xlim=None,
  ylim=None, rot=None, fontsize=None, colormap=None, table=False,
  yerr=None, xerr=None, secondary_y=False, sort_columns=False, **kwds)</p>
  
  <p>Parameters: ax : matplotlib axes object, default None</p>
</blockquote>

<p>You can see that <code>ax</code> is a keyword argument here. It just happens that you also named your variable as <code>ax</code> and you are sending it as the value of that keyword argument to the function <code>plot()</code>.</p>

python matplotlib