Generating plots in a loop #936
-
I want to display several time series in a loop after their titles. What I am trying to do is to put a title first in Markdown, and then retrieve a series and plot it using the What's happening is that when I render, I first get all the titles and then I get all the figures (title, title title, image, image, image). I wanted to get title, image, title, image, title, image, etc.
Am I doing something obviously wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Not sure exactly what df.plot is doing, but this example using ```{python}
import matplotlib.pyplot as plt
from IPython.display import display, Markdown
for x in range(1, 4):
display(Markdown(f"## Plot {x}"))
plt.plot([1,23,2,4])
plt.show()
```
|
Beta Was this translation helpful? Give feedback.
Not sure exactly what df.plot is doing, but this example using
plot.show()
works the way you are expecting:df.plot()
is likely just "attaching" a plot to the cell rather than creating a plot within the stream of outputs.