Skip to content

Generating plots in a loop #936

Answered by jjallaire
lucas-a-meyer asked this question in Q&A
Discussion options

You must be logged in to vote

Not sure exactly what df.plot is doing, but this example using plot.show() works the way you are expecting:

```{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()
```

df.plot() is likely just "attaching" a plot to the cell rather than creating a plot within the stream of outputs.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lucas-a-meyer
Comment options

Answer selected by lucas-a-meyer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants