8000 fixed figlegend clipping bug · matplotlib/matplotlib@2ee682b · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ee682b

Browse files
committed
fixed figlegend clipping bug
svn path=/trunk/matplotlib/; revision=966
1 parent 1734236 commit 2ee682b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def points_to_pixels(self, points):
5454
"""
5555
return points
5656

57+
5758
def get_text_extent(self, text):
5859
"""
5960
Get the text extent in window coords
@@ -91,6 +92,27 @@ def draw_line(self, gc, x1, y1, x2, y2):
9192
"""
9293
pass # derived must override
9394

95+
def _draw_marker(self, gc, path, x, y, trans):
96+
"""
97+
This method is currently uncderscore hidden because the
98+
draw_markers method is being used as a sentinel for newstyle
99+
backend drawing
100+
101+
Draw the marker specified in path with graphics context gx at
102+
each of the locations in arrays x and y. trans is a
103+
matplotlib.transforms.Transformation instance used to
104+
transform x and y to display coords. It consists of an
105+
optional ) nonlinear component and an affine. You can access
106+
these two components as
107+
108+
if transform.need_nonlinear():
109+
x,y = transform.nonlinear_only_numerix(x, y)
110+
# the a,b,c,d,tx,ty affine which transforms x and y
111+
vec6 = transform.as_vec6_val()
112+
...backend dependent affine...
113+
"""
114+
pass
115+
94116
def draw_poly_collection(
95117
self, verts, transform, clipbox, facecolors, edgecolors,
96118
linewidths, antialiaseds, offsets, transOffset):

lib/matplotlib/legend.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ def _get_handles(self, handles, texts):
218218
legline = Line2D(self._xdata, ydata)
219219
legline.update_from(handle)
220220
self._set_artist_props(legline) # after update
221+
legline.set_clip_box(None)
221222
legline.set_markersize(self.markerscale*legline.get_markersize())
222223
legline.set_data_clipping(False)
223224
ret.append(legline)
@@ -228,11 +229,13 @@ def _get_handles(self, handles, texts):
228229
)
229230
p.update_from(handle)
230231
self._set_artist_props(p)
232+
legline.set_clip_box(None)
231233
ret.append(p)
232234
elif isinstance(handle, LineCollection):
233235
ydata = (y-HEIGHT/2)*ones(self._xdata.shape, Float)
234236
legline = Line2D(self._xdata, ydata)
235237
self._set_artist_props(legline)
238+
legline.set_clip_box(None)
236239
lw = handle.get_linewidths()[0]
237240
style = handle.get_linewidths()[0]
238241
color = handle.get_colors()[0]

0 commit comments

Comments
 (0)
0