@@ -247,8 +247,9 @@ def on_dpi_change(fig):
247
247
if self_weakref is not None :
248
248
self_weakref .labelsep = (self_weakref ._labelsep_inches * fig .dpi )
249
249
self_weakref ._initialized = False # simple brute force update
250
- # works because _init is called
251
- # at the start of draw.
250
+ # works because _init is
251
+ # called at the start of
252
+ # draw.
252
253
253
254
self ._cid = Q .ax .figure .callbacks .connect ('dpi_changed' ,
254
255
on_dpi_change )
@@ -258,7 +259,7 @@ def on_dpi_change(fig):
258
259
self .fontproperties = kw .pop ('fontproperties' , dict ())
259
260
self .kw = kw
260
261
_fp = self .fontproperties
261
- #boxprops = dict(facecolor='red')
262
+ # boxprops = dict(facecolor='red')
262
263
self .text = mtext .Text (
263
264
text = label , # bbox=boxprops,
264
265
horizontalalignment = self .halign [self .labelpos ],
@@ -465,10 +466,11 @@ def on_dpi_change(fig):
465
466
self_weakref = weak_self ()
466
467
if self_weakref is not None :
467
468
self_weakref ._new_UV = True # vertices depend on width, span
468
- # which in turn depend on dpi
469
+ # which in turn depend on dpi
469
470
self_weakref ._initialized = False # simple brute force update
470
- # works because _init is called
471
- # at the start of draw.
471
+ # works because _init is
472
+ # called at the start of
473
+ # draw.
472
474
473
475
self ._cid = self .ax .figure .callbacks .connect ('dpi_changed' ,
474
476
on_dpi_change )
@@ -667,7 +669,7 @@ def _h_arrows(self, length):
667
669
length = length .reshape (N , 1 )
668
670
# This number is chosen based on when pixel values overflow in Agg
669
671
# causing rendering errors
670
- #length = np.minimum(length, 2 ** 16)
672
+ # length = np.minimum(length, 2 ** 16)
671
673
np .clip (length , 0 , 2 ** 16 , out = length )
672
674
# x, y: normal horizontal arrow
673
675
x = np .array ([0 , - self .headaxislength ,
@@ -870,9 +872,9 @@ class Barbs(mcollections.PolyCollection):
870
872
From there :meth:`_make_barbs` is used to find the vertices of the
871
873
polygon to represent the barb based on this information.
872
874
'''
873
- #This may be an abuse of polygons here to render what is essentially maybe
874
- #1 triangle and a series of lines. It works fine as far as I can tell
875
- #however.
875
+ # This may be an abuse of polygons here to render what is essentially maybe
876
+ # 1 triangle and a series of lines. It works fine as far as I can tell
877
+ # however.
876
878
@docstring .interpd
877
879
def __init__ (self , ax , * args , ** kw ):
878
880
"""
@@ -892,30 +894,31 @@ def __init__(self, ax, *args, **kw):
892
894
self .flip = kw .pop ('flip_barb' , False )
893
895
transform = kw .pop ('transform' , ax .transData )
894
896
895
- #Flagcolor and and barbcolor provide convenience parameters for setting
896
- #the facecolor and edgecolor, respectively, of the barb polygon. We
897
- #also work here to make the flag the same color as the rest of the barb
898
- #by default
897
+ # Flagcolor and and barbcolor provide convenience parameters for
898
+ # setting the facecolor and edgecolor, respectively, of the barb
899
+ # polygon. We also work here to make the flag the same color as the
900
+ # rest of the barb by default
901
+
899
902
if None in (barbcolor , flagcolor ):
900
903
kw ['edgecolors' ] = 'face'
901
904
if flagcolor :
902
905
kw ['facecolors' ] = flagcolor
903
906
elif barbcolor :
904
907
kw ['facecolors' ] = barbcolor
905
908
else :
906
- #Set to facecolor passed in or default to black
909
+ # Set to facecolor passed in or default to black
907
910
kw .setdefault ('facecolors' , 'k' )
908
911
else :
909
912
kw ['edgecolors' ] = barbcolor
910
913
kw ['facecolors' ] = flagcolor
911
914
912
- #Parse out the data arrays from the various configurations supported
915
+ # Parse out the data arrays from the various configurations supported
913
916
x , y , u , v , c = _parse_args (* args )
914
917
self .x = x
915
918
self .y = y
916
919
xy = np .hstack ((x [:, np .newaxis ], y [:, np .newaxis ]))
917
920
918
- #Make a collection
921
+ # Make a collection
919
922
barb_size = self ._length ** 2 / 4 # Empirically determined
920
923
mcollections .PolyCollection .__init__ (self , [], (barb_size ,),
921
924
offsets = xy ,
@@ -940,8 +943,8 @@ def _find_tails(self, mag, rounding=True, half=5, full=10, flag=50):
940
943
a barb is empty (too low to plot any barbs/flags.
941
944
'''
942
945
943
- #If rounding, round to the nearest multiple of half, the smallest
944
- #increment
946
+ # If rounding, round to the nearest multiple of half, the smallest
947
+ # increment
945
948
if rounding :
946
949
mag = half * (mag / half + 0.5 ).astype (np .int )
947
950
@@ -1002,17 +1005,17 @@ def _make_barbs(self, u, v, nflags, nbarbs, half_barb, empty_flag, length,
1002
1005
properly align with the vector direction.
1003
1006
'''
1004
1007
1005
- #These control the spacing and size of barb elements relative to the
1006
- #length of the shaft
1008
+ # These control the spacing and size of barb elements relative to the
1009
+ # length of the shaft
1007
1010
spacing = length * sizes .get ('spacing' , 0.125 )
1008
1011
full_height = length * sizes .get ('height' , 0.4 )
1009
1012
full_width = length * sizes .get ('width' , 0.25 )
1010
1013
empty_rad = length * sizes .get ('emptybarb' , 0.15 )
1011
1014
1012
- #Controls y point where to pivot the barb.
1015
+ # Controls y point where to pivot the barb.
1013
1016
pivot_points = dict (tip = 0.0 , middle = - length / 2. )
1014
1017
1015
- #Check for flip
1018
+ # Check for flip
1016
1019
if flip :
1017
1020
full_height = - full_height
1018
1021
@@ -1039,11 +1042,11 @@ def _make_barbs(self, u, v, nflags, nbarbs, half_barb, empty_flag, length,
1039
1042
1040
1043
barb_list = []
1041
1044
for index , angle in np .ndenumerate (angles ):
1042
- #If the vector magnitude is too weak to draw anything, plot an
1043
- #empty circle instead
1045
+ # If the vector magnitude is too weak to draw anything, plot an
1046
+ # empty circle instead
1044
1047
if empty_flag [index ]:
1045
- #We can skip the transform since the circle has no preferred
1046
- #orientation
1048
+ # We can skip the transform since the circle has no preferred
1049
+ # orientation
1047
1050
barb_list .append (empty_barb )
1048
1051
continue
1049
1052
0 commit comments