Skip to content

figure changes size at end of loop if drawn dynamically #17

@lucainnocenti

Description

@lucainnocenti

As per the title, consider the following snippet:

import time
import ipympl
import matplotlib.pyplot as plt

fig, ax = plt.subplots(1, 1, figsize=(5, 5))
data = []
plt.show()
for idx in range(4):
    data.append(idx ** 2)
    ax.clear()
    ax.plot(data)
    fig.canvas.draw()
    time.sleep(0.2)

and this is what I get running it:

gyrodown

I used plt.show() at the beginning of the loop because nothing gets drawn otherwise.
Is there a way to avoid this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions