#!/usr/bin/env python # coding: utf-8 # ## Plotting to recall a plot based on SO https://stackoverflow.com/q/76842073/8508004 # In[1]: import matplotlib.pyplot as plt # In[2]: a = range(10) b = [2**x + 5 for x in a] # In[3]: fig = plt.figure(figsize=(2,2)) # In[4]: ax = fig.add_axes([.1,.1,.8,.8]) # In[5]: 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. # In[6]: plt.figure(fig); # In[7]: plt.figure(fig); plt.show() # In[8]: fig # I suggest addition of the following two options based on using the `.figure` attribure, see [here](https://stackoverflow.com/a/76707536/8508004) and [here](https://stackoverflow.com/a/70707556/8508004) and [here](https://stackoverflow.com/a/73326297/8508004) for more information and examples of `.figure` use (or also the third paragraph [here](https://stackoverflow.com/a/60269307/8508004) where sometimes seaborn, which is built on matplotlib, a bit confusingly, uses `.fig` or `.figure` at times): # In[9]: fig.figure # In[10]: ax.figure # In[ ]: