Skip to content

Commit 3f0ae27

Browse files
committed
fixing for pep8
1 parent 9cb6472 commit 3f0ae27

File tree

2 files changed

+53
-55
lines changed

2 files changed

+53
-55
lines changed

lib/matplotlib/legend.py

Lines changed: 39 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ def get_title(self):
803803
return self._legend_title_box._text
804804

805805
def get_window_extent(self, *args, **kwargs):
806-
'return a extent of the the legend'
806+
'return a extent of the legend'
807807
return self.legendPatch.get_window_extent(*args, **kwargs)
808808

809809
def get_frame_on(self):
@@ -999,7 +999,7 @@ class UniformLegend(Legend):
999999
def __str__(self):
10001000
return "uniformLegend"
10011001

1002-
def __init__(self, parent, handles, labels,uniform_size,
1002+
def __init__(self, parent, handles, labels, uniform_size,
10031003
loc=None,
10041004
numpoints=None, # the number of points in the legend line
10051005
markerfirst=True, # controls ordering (left-to-right) of
@@ -1037,56 +1037,46 @@ def __init__(self, parent, handles, labels,uniform_size,
10371037
frameon=None
10381038
):
10391039
uniformHandlerMap = {
1040-
StemContainer:
1040+
StemContainer:
10411041
legend_handler.HandlerUniformStem(uniform_size=uniform_size),
1042-
ErrorbarContainer:
1042+
ErrorbarContainer:
10431043
legend_handler.HandlerUniformErrorBar(uniform_size=uniform_size),
1044-
Line2D: legend_handler.HandlerUniformLine2D(uniform_size=uniform_size),
1045-
PathCollection:
1044+
Line2D:
1045+
legend_handler.HandlerUniformLine2D(uniform_size=uniform_size),
1046+
PathCollection:
10461047
legend_handler.HandlerPathCollection(sizes=[uniform_size]*3),
1047-
RegularPolyCollection:
1048-
legend_handler.HandlerRegularPolyCollection(sizes=[uniform_size]*3),
1049-
CircleCollection:
1048+
RegularPolyCollection:
1049+
legend_handler.HandlerRegularPolyCollection(
1050+
sizes=[uniform_size]*3),
1051+
CircleCollection:
10501052
legend_handler.HandlerCircleCollection(sizes=[uniform_size]*3),
10511053
}
10521054

1053-
Legend.__init__(self,parent,handles,labels,
1054-
loc=loc,
1055-
numpoints=numpoints, # the number of points in the legend line
1056-
markerscale=None, # the relative size of legend markers
1057-
# vs. original
1058-
markerfirst=markerfirst, # controls ordering (left-to-right) of
1059-
# legend marker and label
1060-
scatterpoints=scatterpoints, # number of scatter points
1061-
scatteryoffsets=scatteryoffsets,
1062-
prop=prop, # properties for the legend texts
1063-
fontsize=fontsize, # keyword to set font size directly
1064-
1065-
# spacing & pad defined as a fraction of the font-size
1066-
borderpad=borderpad, # the whitespace inside the legend border
1067-
labelspacing=labelspacing, # the vertical space between the legend
1068-
# entries
1069-
handlelength=handlelength, # the length of the legend handles
1070-
handleheight=handleheight, # the height of the legend handles
1071-
handletextpad=handletextpad, # the pad between the legend handle
1072-
# and text
1073-
borderaxespad=borderaxespad, # the pad between the axes and legend
1074-
# border
1075-
columnspacing=columnspacing, # spacing between columns
1076-
1077-
ncol=1, # number of columns
1078-
mode=mode, # mode for horizontal distribution of columns.
1079-
# None, "expand"
1080-
1081-
fancybox=fancybox, # True use a fancy box, false use a rounded
1082-
# box, none use rc
1083-
shadow=shadow,
1084-
title=title, # set a title for the legend
1085-
1086-
framealpha=framealpha, # set frame alpha
1087-
1088-
bbox_to_anchor=bbox_to_anchor, # bbox that the legend will be anchored.
1089-
bbox_transform=bbox_transform, # transform for the bbox
1090-
frameon=frameon, # draw frame
1091-
handler_map=uniformHandlerMap,
1092-
)
1055+
# Consult Legend.__init__ for purpose of each parameter.
1056+
Legend.__init__(self, parent, handles, labels,
1057+
loc=loc,
1058+
numpoints=numpoints,
1059+
markerscale=None,
1060+
markerfirst=markerfirst,
1061+
scatterpoints=scatterpoints,
1062+
scatteryoffsets=scatteryoffsets,
1063+
prop=prop,
1064+
fontsize=fontsize,
1065+
borderpad=borderpad,
1066+
labelspacing=labelspacing,
1067+
handlelength=handlelength,
1068+
handleheight=handleheight,
1069+
handletextpad=handletextpad,
1070+
borderaxespad=borderaxespad,
1071+
columnspacing=columnspacing,
1072+
ncol=1,
1073+
mode=mode,
1074+
fancybox=fancybox,
1075+
shadow=shadow,
1076+
title=title,
1077+
framealpha=framealpha,
1078+
bbox_to_anchor=bbox_to_anchor,
1079+
bbox_transform=bbox_transform,
1080+
frameon=frameon,
1081+
handler_map=uniformHandlerMap,
1082+
)

lib/matplotlib/legend_handler.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,8 @@ def create_artists(self, legend, orig_handle,
617617
self.update_prop(p, orig_handle, legend)
618618
p.set_transform(trans)
619619
return [p]
620+
621+
620622
class HandlerUniformLine2D(HandlerLine2D):
621623
"""
622624
Handler for Uniform sized Line2D instances
@@ -630,10 +632,13 @@ def create_artists(self, legend, orig_handle,
630632
xdescent, ydescent, width, height, fontsize,
631633
trans):
632634
artists = HandlerLine2D.create_artists(self, legend, orig_handle,
633-
xdescent, ydescent, width, height, fontsize,
634-
trans)
635+
xdescent, ydescent,
636+
width, height,
637+
fontsize, trans)
635638
artists[-1].set_markersize(self._uniform_size)
636639
return artists
640+
641+
637642
class HandlerUniformErrorBar(HandlerErrorbar):
638643
"""
639644
Handler for Uniform sized Error instances
@@ -647,10 +652,13 @@ def create_artists(self, legend, orig_handle,
647652
xdescent, ydescent, width, height, fontsize,
648653
trans):
649654
artists = HandlerErrorbar.create_artists(self, legend, orig_handle,
650-
xdescent, ydescent, width, height, fontsize,
651-
trans)
655+
xdescent, ydescent,
656+
width, height,
657+
fontsize, trans)
652658
artists[-1].set_markersize(self._uniform_size)
653659
return artists
660+
661+
654662
class HandlerUniformStem(HandlerStem):
655663
def __init__(self, uniform_size, **kw):
656664

@@ -662,7 +670,7 @@ def create_artists(self, legend, orig_handle,
662670
trans):
663671
artists = HandlerStem.create_artists(self, legend, orig_handle,
664672
xdescent, ydescent,
665-
width, height, fontsize,
666-
trans)
673+
width, height,
674+
fontsize, trans)
667675
artists[0].set_markersize(self._uniform_size)
668676
return artists

0 commit comments

Comments
 (0)