I am trying to understand the matplotlib API. I have seen many examples like this:
...
fig, (ax0, ax1) = plt.subplots(nrows=2)
ax1.spines['right'].set_visible(False)
...
ax1.xaxis.set_ticks_position('bottom')
...
(full example: http://matplotlib.org/examples/ticks_and_spines/spines_demo.html )
I understand what it does but I was unable to find in the API the spines and xaxis attributes of ax0 and ax1 that was used to retrieve the xaxis and the spines (although there is a documented get_xaxis()
method but nothing for the spines). Of course now I know it for that particular case but are there other hidden attributes? Or perhaps I have not read the documentation correctly? Where these attributes come from? Maybe they were added by fig.subbplots
? I would like to have a list of all public attributes for basic matplotlib objects. Do I really have to resort to the dir
python builtin and guess the signification from the names?
pyplot is a procedural style interface/abstraction over matplotlib's OO API. So pyplot internally creates/manages necessary objects required for plotting. Every object(e.g Line,Axis,Axes ) is an Artist for matplotlib. Each artist has attributes. Have a look over
http://matplotlib.org/users/artists.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With