Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

matplotlib dev: What happened to figure.dpi ? #19928

Closed
@pllim

Description

@pllim

This morning, we got a new error testing against matplotlib dev. Example log athttps://app.circleci.com/pipelines/github/astropy/astropy/4691/workflows/582b72af-3420-4af5-a185-f0e41601edfd/jobs/86623

_______________________ test_no_numpy_warnings[contours] _______________________ignore_matplotlibrc = Nonetmpdir = 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 d49696aba62820ce4bab41ae4a8508743e39a0e4Author: 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 tohttps://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 matplotlibastropy_mpl_style_1= {# ...# Other'savefig.dpi':72,}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp