8000 Some ConnectionStyle not working · Issue #9518 · matplotlib/matplotlib · GitHub 8000
[go: up one dir, main page]

Skip to content
Some ConnectionStyle not working #9518
Closed
@dstansby

Description

@dstansby

Bug report

Bug summary

Some of the ConnectionStyle styles seem to be failing for me. When I run the below code only some of the connectors work:

Code for reproduction

import matplotlib.pyplot as plt
import matplotlib.patches as mpatches

styles = mpatches.ConnectionStyle.get_styles()

n = len(styles)
fig, ax = plt.subplots(figsize=(6, 10))
ax.set_xlim(0, 1)
ax.set_ylim(-1, n)

for i, stylename in enumerate(sorted(styles)):
    patch = mpatches.FancyArrowPatch((0.1, i), (0.8, i + 0.5),
                                     connectionstyle=stylename,
                                     mutation_scale=25)
    try:
        ax.add_patch(patch)
        print(stylename)
    except ValueError as err:
        print(stylename, err)

plt.show()

Actual outcome

angle 'path' it's not a valid quadratic bezier curve
angle3
arc 'path' it's not a valid quadratic bezier curve
arc3
bar 'path' it's not a valid quadratic bezier curve

The specific traceback in one case is:

Traceback (most recent call last):
  File "test.py", line 16, in <module>
    ax.add_patch(patch)
  File "/Users/dstansby/github/matplotlib/lib/matplotlib/axes/_base.py", line 1834, in add_patch
    self._update_patch_limits(p)
  File "/Users/dstansby/github/matplotlib/lib/matplotlib/axes/_base.py", line 1852, in _update_patch_limits
    vertices = patch.get_path().vertices
  File "/Users/dstansby/github/matplotlib/lib/matplotlib/patches.py", line 4322, in get_path
    _path, fillable = self.get_path_in_displaycoord()
  File "/Users/dstansby/github/matplotlib/lib/matplotlib/patches.py", line 4352, in get_path_in_displaycoord
    self.get_mutation_aspect())
  File "/Users/dstansby/github/matplotlib/lib/matplotlib/patches.py", line 3274, in __call__
    return self.transmute(path, mutation_size, linewidth)
  File "/Users/dstansby/github/matplotlib/lib/matplotlib/patches.py", line 3787, in transmute
    x0, y0, x1, y1, x2, y2 = self.ensure_quadratic_bezier(path)
  File "/Users/dstansby/github/matplotlib/lib/matplotlib/patches.py", line 3223, in ensure_quadratic_bezier
    raise ValueError(msg)
ValueError: 'path' it's not a valid quadratic bezier curve

Expected outcome
Expected them all to work

Matplotlib version

  • Operating system: OSX
  • Matplotlib version: master branch
  • Matplotlib backend (print(matplotlib.get_backend())): macosx
  • Python version: 3.6.2
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0