I am self-learning python, and I am very confused by the matplotlib package.
when plotting, is it really necessary to use the below code?
fig = plt.figure()
I thought the code was to define an empty canvas, then we can add subplots to the canvas, but I also see lots of cases where this code is not included, and plt.plot() or plt.subplot() is directly used.
- what are the differences between ax and axes? I used to think both were subplot variables, but later I find that axes is sometimes used as variables and sometimes as arguments in plotting, for instance:
as variables, from this post:
fig, axes = plt.subplots(nrows=3, ncols=2, figsize=(12, 8))
as an argument, from this post
n = len(fig.axes)
Any help would be much appreciated.