Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

colorbar resizes in animation #12550

Copy link
Copy link
Closed
Closed
Copy link
@sakra1

Description

@sakra1
Issue body actions

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.For 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

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.