File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ 2007-04-07 Fixed legend/LineCollection bug. - EF
2+
132007-04-06 Removed deprecated support for a float value as a gray-scale;
24 now it must be a string, like '0.5'. Added alpha kwarg to
35 ColorConverter.to_rgba_list. - EF
Original file line number Diff line number Diff line change @@ -779,6 +779,24 @@ def get_verts(self, dataTrans=None):
779779 raise NotImplementedError ('Vertices in data coordinates are calculated\n '
780780 + 'with offsets only if _transOffset == dataTrans.' )
781781
782+ def get_lines (self ):
783+ 'return seq of lines in collection'
784+ # This is needed for legend, even though it is incomplete,
785+ # like get_verts, and essentially wrong in general.
786+ # We could add a check for validity as in get_verts.
787+ if self ._offsets is None :
788+ offsets = [(0 ,0 )]
789+ else :
790+ offsets = self ._offsets
791+ Noffsets = len (offsets )
792+ Nsegments = len (self ._segments )
793+ lines = []
794+ for i in range (max (Noffsets , Nsegments )):
795+ ox , oy = offsets [i % Noffsets ]
796+ segment = self ._segments [i % Nsegments ]
797+ lines .append ([(x + ox , y + oy ) for x ,y in segment ])
798+ return lines
799+
782800 def update_scalarmappable (self ):
783801 """
784802 If the scalar mappable array is not none, update colors
Original file line number Diff line number Diff line change @@ -52,7 +52,6 @@ def line_cuts_bbox(line, bbox):
5252
5353 if n == 1 :
5454 return bbox .contains (line [0 ][0 ], line [0 ][1 ])
55-
5655 p1 = line [0 ]
5756 for p2 in line [1 :]:
5857 segment = (p1 , p2 )
@@ -359,7 +358,7 @@ def get_handles(ax):
359358 for line in hlines :
360359 tline = trans .seq_xy_tups (line )
361360 aline = [inv (v ) for v in tline ]
362- lines .extend ( line )
361+ lines .append ( aline )
363362
364363 return [vertices , bboxes , lines ]
365364
You can’t perform that action at this time.
0 commit comments