I wondered what the logic is behind the question when to use the plot instance (which is a PathCollection
) and when to use the plot class itself.
import matplotlib.pyplot as plt
p = plt.scatter([1,2,3],[1,2,3])
brings up a scatter plot. To make it work, I have to say:
plt.annotate(...)
and to configure axes labels or limits, you write:
plt.xlim(...)
plt.xlabel(...)
and so on.
But on the other hand, you write:
p.axes.set_aspect(...)
p.axes.yaxis.set_major_locator(...)
What is the logic behind this? Can I look it up somewhere? Unfortunately, I haven't found an answer to this particular question in the documentation.
When do you use the actual instance p
for configuration of your graph and when do you use the pyplot class plt
?