When we create a new figure:
import matplotlib.pyplot as plt
fig = plt.figure()
we can see in the console an output like:
<Figure size 432x288 with 0 Axes>
so when we use add_axes:
add_axes(rect, projection=None, polar=False, **kwargs)
are we actually defining the x,y axes that encompass the "box" that will bound the figure (the axes in a more mathematical sense) and nothing more? or in fact this line of code is creating an empty figure with the desired dimensions in which any data we add later will be fitted in? (or None of the above maybe?)
That questioning left me wondering how can I physically understand what the axes are for matplotlib.
Thanks for helping.
From the point of view of the viewer, the axes is the box which will contain the data and which (usually) has an x-axis and y-axis.
From the programmatical point of view, the axes is an object, which stores several other objects like XAxis
, YAxis
and provides methods to create plots. Importantly, it has a transformation stored, which allows to draw the data points in pixel space.
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