Skip to content

[Doc]: Axes limits not updated in animate decay #24296

@story645

Description

@story645

Documentation Link

https://matplotlib.org/devdocs/gallery/animation/animate_decay.html#sphx-glr-gallery-animation-animate-decay-py

Problem

Animate decay claims it shows how to changing axes limits during an animation in the run method

def run(data):
    # update the data
    t, y = data
    xdata.append(t)
    ydata.append(y)
    xmin, xmax = ax.get_xlim()

    if t >= xmax:
        ax.set_xlim(xmin, 2*xmax)
        ax.figure.canvas.draw()
    line.set_data(xdata, ydata)

but the limits aren't actually changing:

91679bc3-c559-48dd-8c6e-9f7e9a8157bd.mp4

Suggested improvement

Either option is fine with me:

  • fix code so xlims dynamically updated
  • remove lim updating code and statement saying this example shows how to update limits

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions