Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Path.arc breaks for some full-circle inputs #8992

Closed
@QuLogic

Description

@QuLogic

I noticed that my spines would spontaneously disappear when testing #4699. It turns out that Path.arc sometimes does not produce a valid arc.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.path as mpath


start_angles = np.arange(-720, 361, 45)

fig, axes = plt.subplots(5, 5, figsize=(8, 8))
assert axes.size >= len(start_angles)

for offset, ax in zip(start_angles, axes.flat):
    low = 0 + offset
    high = 360 + offset

    path = mpath.Path.arc(low, high)
    patch = mpatches.PathPatch(path)
    ax.add_patch(patch)

    title = '%.2f\N{Greek Small Letter Pi} \N{Em dash} %.2f\N{Greek Small Letter Pi}' % (
            low / 180,
            high / 180)
    title += '\n%d \N{Em dash} %d' % (low, high)
    mins = np.min(path.vertices, axis=0)
    maxs = np.max(path.vertices, axis=0)
    ax.set(xlim=(mins[0], maxs[0]),
           ylim=(mins[1], maxs[1]),
           aspect='equal',
           title=title)

fig.tight_layout()

plt.show()

Actual outcome

figure_1

Expected outcome

I expect full circles in all cases.

Matplotlib version

  • Operating System: Fedora 26 + conda
  • Matplotlib Version: master (6582a9d)
  • Python Version: 3.6

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions