Repository navigation
Closed
Description
This morning, we got a new error testing against matplotlib dev. Example log at https://app.circleci.com/pipelines/github/astropy/astropy/4691/workflows/582b72af-3420-4af5-a185-f0e41601edfd/jobs/86623
_______________________ test_no_numpy_warnings[contours] _______________________
ignore_matplotlibrc = None
tmpdir = local('/tmp/pytest-of-root/pytest-0/test_no_numpy_warnings_contour0')
grid_type = 'contours'
@pytest.mark.parametrize('grid_type', ['lines', 'contours'])
def test_no_numpy_warnings(ignore_matplotlibrc, tmpdir, grid_type):
ax = plt.subplot(1, 1, 1, projection=WCS(TARGET_HEADER))
ax.imshow(np.zeros((100, 200)))
ax.coords.grid(color='white', grid_type=grid_type)
with pytest.warns(None) as warning_lines:
> plt.savefig(tmpdir.join('test.png').strpath)
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/astropy/visualization/wcsaxes/tests/test_misc.py:80:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/matplotlib/pyplot.py:956: in savefig
fig.canvas.draw_idle() # need this if 'transparent=True' to reset colors
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/matplotlib/backend_bases.py:2058: in draw_idle
self.draw(*args, **kwargs)
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py:406: in draw
self.figure.draw(self.renderer)
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/matplotlib/artist.py:74: in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/matplotlib/artist.py:51: in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/matplotlib/figure.py:2727: in draw
renderer, self, artists, self.suppressComposite)
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/matplotlib/image.py:132: in _draw_list_compositing_images
a.draw(renderer)
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/astropy/visualization/wcsaxes/core.py:459: in draw
super().draw(renderer, **kwargs)
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/matplotlib/artist.py:51: in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/matplotlib/_api/deprecation.py:421: in wrapper
return func(*inner_args, **inner_kwargs)
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/matplotlib/axes/_base.py:3102: in draw
mimage._draw_list_compositing_images(renderer, self, artists)
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/matplotlib/image.py:132: in _draw_list_compositing_images
a.draw(renderer)
../../.tox/py37-test-image-mpldev/lib/python3.7/site-packages/matplotlib/artist.py:51: in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <matplotlib.collections.PathCollection object at 0x7f51ca1ac128>
renderer = <matplotlib.backends.backend_agg.RendererAgg object at 0x7f51cc0a0ef0>
@artist.allow_rasterization
def draw(self, renderer):
> self.set_sizes(self._sizes, self.figure.dpi)
E AttributeError: 'NoneType' object has no attribute 'dpi'
bisect attempt
d49696a is the first bad commit
commit d49696aba62820ce4bab41ae4a8508743e39a0e4
Author: Jody Klymak <...>
Date: Sun Mar 14 14:08:50 2021 -0700
New doc gallery for plot_types
Update: I don't think this is true actually... I have no idea what is going on
I think I traced it to https://github.com/astropy/astropy/blob/796b585f989319b766979df2110e0b4fa94a43a1/astropy/visualization/mpl_style.py#L63 . However, I am not sure if I should simply remove this setting or there is a new way to set it. Any advise would be greatly appreciated. Thanks!
# Version 1 astropy plotting style for matplotlib
astropy_mpl_style_1 = {
# ...
# Other
'savefig.dpi': 72,
}Metadata
Metadata
Assignees
Labels
No labels
Activity
pllim commentedon Apr 9, 2021
pllim commentedon Apr 9, 2021
Update: Okay, I did manage to bisect and
gitsaid it is #19703 . I can't say I understand the details enough to formulate a fix based on this info. I might also have been bisecting it wrong so you can double check. Here are my scripts:run_me.sh:#!/bin/sh python run_me.pyrun_me.py:jklymak commentedon Apr 9, 2021
It is pretty hard to see how #19703 could have caused any downstream issues since it doesn't change anything user facing, except to add a new style.
I'm not convinced this is Matplotlib's issue:
works fine on master.
pllim commentedon Apr 9, 2021
Indeed, I couldn't reproduce this if I take out the
astropystuff and seems to only affect contours. I'll have to defer to the expertise of @astrofrog and @Cadair here.jklymak commentedon Apr 9, 2021
I'm going to close for now because this has gotten a bit confusing, but feel free to open a new issue if you narrow it down to something we broke. Thanks again for testing us early on!
tacaswell commentedon Apr 9, 2021
The issue is not that
figure.dpihas gone away, the issue is thatself.figure is Nonejklymak commentedon Apr 9, 2021
Is this possibly the
add_axesissue? #19496, #18364? and somehow this axes is not being added to the figure?pllim commentedon Apr 10, 2021
I think I did the bisect wrong. It gives me different answer depending on where I set the "good". I can't seem to find an option that is equivalent to
-m 1for cherry-pick.The only thing I am sure of is that this is caused by something that got merged in the past 24-36 hours (as of writing). Let's just wait for Tom Robitaille and Stuart Mumford's inputs. I don't usually work with that part of the code, and I need to move on to other work. Thanks, everyone!