Skip to content

colorbar resizes in animation #12550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sakra1 opened this issue Oct 17, 2018 · 4 comments
Closed

colorbar resizes in animation #12550

sakra1 opened this issue Oct 17, 2018 · 4 comments
Assignees
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Milestone

Comments

@sakra1
Copy link

sakra1 commented Oct 17, 2018

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.

@ImportanceOfBeingErnest ImportanceOfBeingErnest added this to the v3.0.x milestone Oct 17, 2018
@ImportanceOfBeingErnest ImportanceOfBeingErnest added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Oct 17, 2018
@ImportanceOfBeingErnest
Copy link
Member

This bug came in in ENH: adjustable colorbar ticks #9903.

@sakra1
Copy link
Author

sakra1 commented Oct 17, 2018

Apologies for my lack of experience with Python, and bug reporting, but I am confused about the #9903 issue. Unfortunately I do not fully grasp that piece of Python code, but also that issue was reported in December 2017 with a Matplotlib version earlier than 2.2.3, which does not reveal the issue I raised above. Are you saying my animation issue is a new but comparable issue that is introduced in Matplotlib 3.0.0?

@ImportanceOfBeingErnest
Copy link
Member

@sakra1 Your bug report is fine, thanks for that. To explain a bit on the structure here:

The bug appears first in the development version after #9903 has been merged on 22 March. (This can be found out via git bisect) This commit has been tagged for the 3.0 branch, such that it is not part of the (later) 2.2.3 release. The first release with this bug in it is hence the 3.0.0rc1.

@jklymak jklymak self-assigned this Oct 17, 2018
@jklymak
Copy link
Member

jklymak commented Oct 17, 2018

Yes, sorry this broke. I believe it is fixed in #12159 and on master, and will be part of 3.0.1 release in early Nov.

@jklymak jklymak closed this as completed Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

No branches or pull requests

3 participants