Skip to content

set_marker(Path) is broken #10920

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
alchayward opened this issue Mar 30, 2018 · 2 comments
Closed

set_marker(Path) is broken #10920

alchayward opened this issue Mar 30, 2018 · 2 comments

Comments

@alchayward
Copy link

Bug report

Bug summary

When a mpl.path.Path() is supplied to markers.MarkerStyle.set_marker we get a type error. This is due to the Path class being a Sized instance, since it implements len, and this is the property used to determine if set_marker was passed a set of verts (list of (x,y) pairs).

Code for reproduction

import matplotlib as mpl
import scipy as sp
xs = sp.linspace(0,1,20)
ys = xs + 0.1*sp.rand((20))-0.05
fig, ax = mpl.subplots(1,1)
ax.plot(xs,ys,marker=mpl.path.Path([[0,0],[1,1]]))

Actual outcome

/anaconda3/envs/physics/lib/python3.6/site-packages/matplotlib/markers.py in set_marker(self, marker)
    254             self._marker_function = self._set_vertices
    255         elif (isinstance(marker, Sized) and len(marker) in (2, 3) and
--> 256                 marker[1] in (0, 1, 2, 3)):
    257             self._marker_function = self._set_tuple_marker
    258         elif (not isinstance(marker, (np.ndarray, list)) and

TypeError: 'Path' object does not support indexing

Expected outcome

Should set the marker to the supplied path
Matplotlib version

  • Operating system: MacOSX
  • Matplotlib version: '2.1.2'
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: '3.6.4'
conda
@QuLogic
Copy link
Member

QuLogic commented Mar 30, 2018

Did this work in some older version? (which one?)

This was fixed by #10632.

@QuLogic QuLogic closed this as completed Mar 30, 2018
@alchayward
Copy link
Author

Quite right. I should have looked harder.

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