broadinstitute / ml4h

Other
122 stars 23 forks source link

fix display of MRI images in plot_mri_tensor_as_animation #456

Open deflaux opened 3 years ago

deflaux commented 3 years ago

What When using matplotlib 3.4 instead of 3.3 or older, the images displayed by ml4h.visualization_tools.hd5_mri_plots.plot_mri_tensor_as_animation display one after another instead of replacing the prior image. (The animation is no longer an animation.)

This appears to be due to https://matplotlib.org/stable/users/whats_new.html#changes-to-behavior-of-axes-creation-methods-gca-add-axes-add-subplot

How Update the usage of matplot lib to correctly replace the images.

Acceptance Criteria It appears as an animation again.

deflaux commented 3 years ago

Note that %matplotlib notebook instead of %matplotlib inline sorta fixes it on Jupyter, but not on JupyterLab.

deflaux commented 3 years ago

Testing on newer Docker images for both Terra (e.g., https://github.com/broadinstitute/ml4h/pull/469) and GCP Notebooks fixes the issue.

So this was not due to a behavior change in matplotlib 3.4, but due to some bug fixed in a more recent Python package version.