import matplotlib.pyplot as plt
a = range(10)
b = [2**x + 5 for x in a]
fig = plt.figure(figsize=(2,2))
<Figure size 200x200 with 0 Axes>
ax = fig.add_axes([.1,.1,.8,.8])
ax.plot(a,b, label='b');
I didn't think for the next line plt.show()
would be necessary in modern Jupyter to show the plot as in the demo , but it was needed! Oddd.
plt.figure(fig);
plt.figure(fig); plt.show()
fig
I suggest addition of the following two options based on using the .figure
attribure, see here and here and here for more information and examples of .figure
use (or also the third paragraph here where sometimes seaborn, which is built on matplotlib, a bit confusingly, uses .fig
or .figure
at times):
fig.figure
ax.figure