8000 colorbar resizes in animation · Issue #12550 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
colorbar resizes in animation #12550
@sakra1

Description

@sakra1

Bug report

When animating a 2D plot with a colorbar, updating the color limits in each iteration changes the size of the colorbar. This issue did not exist with matplotlib 2.2.3.

import numpy as np
import matplotlib.pyplot as plt
from scipy.ndimage import laplace


def main():
    time = np.arange(0, 1, 0.01)
    c = np.zeros(shape=(11, 11))
    c[5, 5] = 1

    fig = plt.figure()
    ax = fig.gca()
    im = ax.imshow(c)
    fig.colorbar(im)

    for t in time:
        c += laplace(c) / 10
        im.set_data(c)
        im.set_clim(0, np.max(c))
        plt.pause(0.001)
    plt.show()


if __name__ == "__main__":
    main()

Actual outcome
outcome_matplotlib300

Expected outcome
outcome_matplotlib223

Matplotlib version

  • Operating system: windows 7
  • Matplotlib version: 3.0.0
  • Matplotlib backend (print(matplotlib.get_backend())): TkAgg
  • Python version: 3.7

Python was installed using the latest Anaconda distribution.

Metadata

Metadata

Assignees

Labels

Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0