-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Description
The docstring for RendererBase.draw_markers states
Draws a marker at each of the vertices in path. This includes
all vertices, including control points on curves. To avoid
that behavior, those vertices should be removed before calling
this function.
but in fact, control points are dropped by the implementation:
for vertices, codes in path.iter_segments(trans, simplify=False):
if len(vertices):
x, y = vertices[-2:] # <- HERE
self.draw_path(gc, marker_path,
marker_trans +
transforms.Affine2D().translate(x, y),
rgbFace)
(other backends contain similar lines).
The discrepancy seems to have been introduced back in 2008 (39e7488).
The only points in the codebase where draw_markers is called all pass in a newly constructed Path with no curve codes (lines.py, collections.py, axis_artist.py; patheffect.py redefines draw_markers by passing in whatever Path it was given) so no one was going to ever notice unless they are directly calling draw_markers themselves. For efficiency purposes, I think it makes most sense to go back to the behavior of docstring (as it avoids having to go through iter_segments to determine which points are true vertices and which are control points).
Semantically, it would make most sense if the path
argument to draw_markers was not a Path but, in fact, just an (N, 2) array, but I sense that there may be reluctance in changing that :-)