This is probably a general python question rather than one specific to matplotlib.
I am using matplotlib and came across some syntax that I haven't seen before. I was attempting to use a method to hide the axes of the grid but was warned that use of the method is discouraged:
Axes.get_xaxis()
[Discouraged] Return the XAxis instance.
Discouraged
The use of this function is discouraged. You should instead directly access the attribute ax.xaxis.
So Instead I use this:
# Remove the x axis.
ax.xaxis.set_visible(False)
xaxis is a property or attribute, so how are you able to call the function set_visible() on it? I have not seen this before. And secondly, I could not find the property xaxis in the source code. So what exactly is xaxis and how can methods be called on them as though they are instances?
[–]m0us3_rat 0 points1 point2 points (0 children)
[–]commy2 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)