I have a jupyter notebook and you want to create a plot in one cell, and then write some markdown to explain it in the next, and then set the limits and talk again in the next. This is my code:
# %% %matplotlib inline import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 2 * np.pi) y = np.sin(x ** 2) plt.plot(x, y); # %% Some markdown text to explain what going on before we zoom in on the interesting bit # %% plt.xlim(xmax=2);
The beginning of each cell is marked with # %% above. The third cell shows an empty number.
I know plt.subplots(2) for building 2 graphs from one cell, but this does not allow me to have a markdown between graphs.
Thanks in advance for your help.
source share