Skip to content
  • Sponsor matplotlib/matplotlib

  • Notifications You must be signed in to change notification settings
  • Fork 7.9k

Arcs with large radii in small  #17547

Closed
@LanceJenkinZA

Description

@LanceJenkinZA

Bug report

Bug summary

No matplotlib.patches.Arc is being rendering when trying to add a small segment of a circle with a large radius.

If I increase the x and y limits to include a larger section of the arc then it is rendered.

Code for reproduction

import matplotlib.pylab as pl
from matplotlib import patches

fig = pl.figure()
ax = pl.gca()
x = 212.02529006006412
y = -2115.252900600641
diameter = 4261.655587271447
a = patches.Arc((x, y), diameter, diameter, fill=False)

ax.add_patch(a)
pl.xlim(0, 20)
pl.ylim(0, 20)
fig.show()

Actual outcome

An empty figure:

image

Expected outcome

A figure with a small section of an arc starting a $(0, 5)$ and ending at $(7.98894818241678, 10.0)$
image

Matplotlib version

  • Operating system: Windows 10 Pro
  • Matplotlib version: 3.2.1
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: Python 3.7.5
  • Jupyter version (if applicable): Version 0.35.6
  • Other libraries:

Activity

LanceJenkinZA

LanceJenkinZA commented on Jun 1, 2020

@LanceJenkinZA
Author

The issue is with the comparison on Line L1669 of patches.py:

        # Get width and height in pixels
        width, height = self.get_transform().transform((width, height))
        inv_error = (1.0 / 1.89818e-6) * 0.5
        if width < inv_error and height < inv_error:
            self._path = Path.arc(theta1, theta2)
            return Patch.draw(self, renderer)

For this case I'm getting:

inv_error = 263410.21399445785
width = 21326216.85880001
height = 89320455.38223404

I've disabled the check and it does render correctly:

image

added this to the v3.2.2 milestone on Jun 2, 2020
added
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
on Jun 2, 2020
anntzer

anntzer commented on Jun 2, 2020

@anntzer
Contributor

This bisects to #8047 (2.1). So it should be fixed but I'm not sure it's release critical.

tacaswell

tacaswell commented on Jun 2, 2020

@tacaswell
Member

The Arc artists is designed to either draw the full circle and let it get clipped or to render the arc using a more accurate (and expensive) method.

I also just got to this bisecting to a 2.1 change so it is not a recent regression, but it should still be fixed ASAP as this is a rather terrible bug.

tacaswell

tacaswell commented on Jun 2, 2020

@tacaswell
Member

The fix seems to be pretty simple, we need to not do the stretching when going through the accurate path.

added 3 commits that reference this issue on Jun 3, 2020
697f330
18c5357
332a207
added 4 commits that reference this issue on Jun 5, 2020
cc9e35c
719a920
9ef4674
620af63

3 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Arcs with large radii in small · Issue #17547 · matplotlib/matplotlib