Skip to content

patches.Arc objects randomly drawing the full ellipse #9659

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
scnorton opened this issue Nov 1, 2017 · 3 comments
Closed

patches.Arc objects randomly drawing the full ellipse #9659

scnorton opened this issue Nov 1, 2017 · 3 comments
Milestone

Comments

@scnorton
Copy link

scnorton commented Nov 1, 2017

Bug report

Bug summary

Providing theta1 and theta2 to the Arc constructor sometimes causes the arc to be drawn as the full ellipse.

Code for reproduction

from matplotlib.patches import Arc
import matplotlib.pyplot as plt

patches = [
    Arc((143954140, 374), 476, 476, theta1=0, theta2=180),
    Arc((143954902, 374), 2001, 749, theta1=0, theta2=180),
    Arc((143955137, 374), 2471, 749, theta1=0, theta2=180),
    Arc((143955276, 374), 2748, 749, theta1=0, theta2=180),
    Arc((143955362, 374), 2022, 749, theta1=0, theta2=180),
    Arc((143955500, 374), 2299, 749, theta1=0, theta2=180),
    Arc((143955641, 374), 488, 488, theta1=0, theta2=180),
    Arc((143955650, 374), 506, 506, theta1=0, theta2=180),
    Arc((143955885, 374), 976, 749, theta1=0, theta2=180),
    Arc((143956128, 374), 489, 489, theta1=0, theta2=180),
    Arc((143956135, 374), 467, 467, theta1=0, theta2=180),
    Arc((143956137, 374), 471, 471, theta1=0, theta2=180),
    Arc((143956276, 374), 748, 748, theta1=0, theta2=180),
    Arc((143956515, 374), 1226, 749, theta1=0, theta2=180),
    Arc((143956167, 374), 412, 412, theta1=0, theta2=180),
    Arc((143956170, 374), 402, 402, theta1=0, theta2=180),
    Arc((143956172, 374), 401, 401, theta1=0, theta2=180),
    Arc((143956183, 374), 380, 380, theta1=0, theta2=180),
    Arc((143956321, 374), 657, 657, theta1=0, theta2=180),
    Arc((143956610, 374), 80, 80, theta1=0, theta2=180),
    Arc((143956849, 374), 558, 558, theta1=0, theta2=180),
    Arc((143956928, 374), 400, 400, theta1=0, theta2=180),
    Arc((143956960, 374), 335, 335, theta1=0, theta2=180),
    Arc((143956962, 374), 331, 331, theta1=0, theta2=180),
    Arc((143957055, 374), 146, 146, theta1=0, theta2=180),
    Arc((143957346, 374), 105, 105, theta1=0, theta2=180),
    Arc((143957397, 374), 207, 207, theta1=0, theta2=180),
    Arc((143957448, 374), 308, 308, theta1=0, theta2=180),
    Arc((143957459, 374), 331, 331, theta1=0, theta2=180),
    Arc((143957475, 374), 363, 363, theta1=0, theta2=180),
    Arc((143957696, 374), 804, 749, theta1=0, theta2=180),
    Arc((143958871, 374), 3154, 749, theta1=0, theta2=180),
    Arc((143957954, 374), 287, 287, theta1=0, theta2=180),
    Arc((143957957, 374), 292, 292, theta1=0, theta2=180),
    Arc((143958125, 374), 628, 628, theta1=0, theta2=180),
    Arc((143958305, 374), 268, 268, theta1=0, theta2=180),
    Arc((143958313, 374), 251, 251, theta1=0, theta2=180),
    Arc((143958368, 374), 142, 142, theta1=0, theta2=180),
    Arc((143958369, 374), 136, 136, theta1=0, theta2=180),
    Arc((143958370, 374), 138, 138, theta1=0, theta2=180),
    Arc((143958905, 374), 535, 535, theta1=0, theta2=180),
    Arc((143959528, 374), 1780, 749, theta1=0, theta2=180),
    Arc((143959543, 374), 1810, 749, theta1=0, theta2=180),
    Arc((143959544, 374), 1813, 749, theta1=0, theta2=180),
    Arc((143959849, 374), 1198, 749, theta1=0, theta2=180),
    Arc((143960119, 374), 658, 658, theta1=0, theta2=180),
    Arc((143960678, 374), 151, 151, theta1=0, theta2=180),
    Arc((143960682, 374), 158, 158, theta1=0, theta2=180),
    Arc((143960682, 374), 159, 159, theta1=0, theta2=180),
    Arc((143960723, 374), 241, 241, theta1=0, theta2=180),
    Arc((143960797, 374), 388, 388, theta1=0, theta2=180),
    Arc((143960845, 374), 484, 484, theta1=0, theta2=180),
    Arc((143960809, 374), 363, 363, theta1=0, theta2=180),
    Arc((143960943, 374), 95, 95, theta1=0, theta2=180),
    Arc((143960945, 374), 92, 92, theta1=0, theta2=180)
]

plt.figure()
ax = plt.gca()
map(ax.add_patch, patches)
plt.xlim(143953697, 143961337)
plt.ylim(-150, 900)
plt.show()

Actual outcome

image

Expected outcome

All the arcs should be half-ellipses above the line y = 0.5.

Matplotlib version

  • Operating system: Mac OS Sierra
  • Matplotlib version: 2.1.0
  • Matplotlib backend (print(matplotlib.get_backend())): MacOSX
  • Python version: 2.7.14 (Homebrew)
  • Jupyter version (if applicable):
  • Other libraries: numpy 13.3.3

python 2.7.14 from homebrew (brew install python); matplotlib from pip (sudo -H pip install matplotlib)

@jklymak
Copy link
Member

jklymak commented Nov 1, 2017

This isn’t quite as minimal as it could be 😉

If you could isolate which patch causes the error you’ll probably get prompter help.

@QuLogic
Copy link
Member

QuLogic commented Nov 1, 2017

This is triggered by drawing "large" ellipses (where large is determined by some random constant of unknown origin); the fix itself turns out to be quite trivial.

QuLogic added a commit to QuLogic/matplotlib that referenced this issue Nov 2, 2017
Large width/height triggers a different code path that didn't correctly
draw limited arcs instead of the whole ellipse.

Fixes matplotlib#9659.
@scnorton
Copy link
Author

scnorton commented Nov 2, 2017

QuLogic, you're absolutely right. There does appear to be a size relationship. Below please find a filtered list of patches to include only the ones on which the problem is observed:

import matplotlib
from matplotlib.patches import Arc
import matplotlib.pyplot as plt

patches = [
    Arc((143955137, 374), 2471, 749, theta1=0, theta2=180),
    Arc((143955276, 374), 2748, 749, theta1=0, theta2=180),
    Arc((143955362, 374), 2022, 749, theta1=0, theta2=180),
    Arc((143955500, 374), 2299, 749, theta1=0, theta2=180),
    Arc((143958871, 374), 3154, 749, theta1=0, theta2=180)
]

print(matplotlib.get_backend())
plt.figure()
ax = plt.gca()
map(ax.add_patch, patches)
plt.xlim(143953697, 143961337)
plt.ylim(-150, 900)
plt.show()
plt.close()

Output:
image

@QuLogic QuLogic added this to the v2.1.1 milestone Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants