Skip to content

Arc patch with starting and ending angle #8046

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
pdhall99 opened this issue Feb 8, 2017 · 3 comments
Closed

Arc patch with starting and ending angle #8046

pdhall99 opened this issue Feb 8, 2017 · 3 comments
Assignees
Milestone

Comments

@pdhall99
Copy link

pdhall99 commented Feb 8, 2017

Bug report

Bug summary

  • Arc patch does not behave as expected when drawing elliptical arcs between two angles specified by theta1 and theta2.

Code for reproduction

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

# Ellipse parameters
R = 1.0
x, y = 0.0, 0.0
a, b = 2.0*R, R

# Figure setup
fig_width, fig_height = 3.30, 3.30
fig = plt.figure(figsize=(fig_width, fig_height), frameon=False)
ax = fig.add_axes([0.0, 0.0, 1.0, 1.0], aspect='equal')
ax.set_axis_off()
ax.set_xlim(-R*1.05, R*1.05)
ax.set_ylim(-R*1.05, R*1.05)
# Axes
ax.axhline(0.0)
ax.axvline(0.0)
# 45 degree line
ax.plot([0.0, 1.0], [0.0, 1.0], 'k--')
# Arcs
ax.add_patch(Arc((x, y), a, b, 
                 theta1=0.0, theta2=360.0, edgecolor='k'))
ax.add_patch(Arc((x, y), a, b,
                 theta1=0.0, theta2=45.0, edgecolor='r', lw=1.5))
fig.savefig('Arc_patch_bug.png')

Actual outcome

arc_patch_bug

Expected outcome

  • Red elliptical arc between the x-axis (0 degrees) and the dashed line (45 degrees), following the black ellipse.

Matplotlib version

  • Matplotlib 2.0.0, Python 2.7.13, OSX
  • Installed with MacPorts
@dstansby
Copy link
Member

dstansby commented Feb 8, 2017

I'm trying to run your example, but you haven't specified angle_deg anywhere in the code (so adding the patches fails).

@dstansby
Copy link
Member

dstansby commented Feb 8, 2017

I can reproduce this using a stripped down example:

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

# Ellipse parameters
R = 1
x, y = 0, 0
a, b = 2 * R, R

# Figure setup
fig, ax = plt.subplots()
ax.set_xlim(-R * 1.05, R * 1.05)
ax.set_ylim(-R * 1.05, R * 1.05)
# 45 degree line
ax.plot([0, 1], [0, 1])
# Arcs
ax.add_patch(Arc((x, y), a, b,
                 theta1=0, theta2=360, edgecolor='k'))
ax.add_patch(Arc((x, y), a, b,
                 theta1=0, theta2=45, edgecolor='r', lw=1.5))
plt.show()

I'm guessing this is because the aspect ratio of the ellipse isn't 1

@pdhall99
Copy link
Author

pdhall99 commented Feb 8, 2017

I'm trying to run your example, but you haven't specified angle_deg anywhere in the code (so adding the patches fails).

Thanks for pointing out that error. I've corrected it in the original report.

@dstansby dstansby added this to the 2.1 (next point release) milestone Feb 8, 2017
@dstansby dstansby self-assigned this Feb 8, 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

2 participants