Closed
Description
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'
Metadata
Metadata
Assignees
Labels
No labels