@@ -1339,17 +1339,17 @@ def __init__(self, x, y, dx, dy, width=0.001, length_includes_head=False,
13391339
13401340 %(Patch_kwdoc)s
13411341 """
1342- self .x = x
1343- self .y = y
1344- self .dx = dx
1345- self .dy = dy
1346- self .width = width
1347- self .length_includes_head = length_includes_head
1348- self .head_width = head_width
1349- self .head_length = head_length
1350- self .shape = shape
1351- self .overhang = overhang
1352- self .head_starts_at_zero = head_starts_at_zero
1342+ self ._x = x
1343+ self ._y = y
1344+ self ._dx = dx
1345+ self ._dy = dy
1346+ self ._width = width
1347+ self ._length_includes_head = length_includes_head
1348+ self ._head_width = head_width
1349+ self ._head_length = head_length
1350+ self ._shape = shape
1351+ self ._overhang = overhang
1352+ self ._head_starts_at_zero = head_starts_at_zero
13531353 self ._make_verts ()
13541354 super ().__init__ (self .verts , closed = True , ** kwargs )
13551355
@@ -1377,43 +1377,44 @@ def set_data(self, *, x=None, y=None, dx=None, dy=None, width=None,
13771377 Length of arrow head.
13781378 """
13791379 if x is not None :
1380- self .x = x
1380+ self ._x = x
13811381 if y is not None :
1382- self .y = y
1382+ self ._y = y
13831383 if dx is not None :
1384- self .dx = dx
1384+ self ._dx = dx
13851385 if dy is not None :
1386- self .dy = dy
1386+ self ._dy = dy
13871387 if width is not None :
1388- self .width = width
1388+ self ._width = width
13891389 if head_width is not None :
1390- self .head_width = head_width
1390+ self ._head_width = head_width
13911391 if head_length is not None :
1392- self .head_length = head_length
1392+ self ._head_length = head_length
13931393 self ._make_verts ()
13941394 self .set_xy (self .verts )
13951395
13961396 def _make_verts (self ):
1397- if self .head_width is None :
1398- head_width = 3 * self .width
1397+ if self ._head_width is None :
1398+ head_width = 3 * self ._width
13991399 else :
1400- head_width = self .head_width
1401- if self .head_length is None :
1400+ head_width = self ._head_width
1401+ if self ._head_length is None :
14021402 head_length = 1.5 * head_width
14031403 else :
1404- head_length = self .head_length
1404+ head_length = self ._head_length
14051405
1406- distance = np .hypot (self .dx , self .dy )
1406+ distance = np .hypot (self ._dx , self ._dy )
14071407
1408- if self .length_includes_head :
1408+ if self ._length_includes_head :
14091409 length = distance
14101410 else :
14111411 length = distance + head_length
14121412 if not length :
14131413 self .verts = np .empty ([0 , 2 ]) # display nothing if empty
14141414 else :
14151415 # start by drawing horizontal arrow, point at (0, 0)
1416- hw , hl , hs , lw = head_width , head_length , self .overhang , self .width
1416+ hw , hl = head_width , head_length
1417+ hs , lw = self ._overhang , self ._width
14171418 left_half_arrow = np .array ([
14181419 [0.0 , 0.0 ], # tip
14191420 [- hl , - hw / 2 ], # leftmost
@@ -1422,19 +1423,19 @@ def _make_verts(self):
14221423 [- length , 0 ],
14231424 ])
14241425 # if we're not including the head, shift up by head length
1425- if not self .length_includes_head :
1426+ if not self ._length_includes_head :
14261427 left_half_arrow += [head_length , 0 ]
14271428 # if the head starts at 0, shift up by another head length
1428- if self .head_starts_at_zero :
1429+ if self ._head_starts_at_zero :
14291430 left_half_arrow += [head_length / 2 , 0 ]
14301431 # figure out the shape, and complete accordingly
1431- if self .shape == 'left' :
1432+ if self ._shape == 'left' :
14321433 coords = left_half_arrow
14331434 else :
14341435 right_half_arrow = left_half_arrow * [1 , - 1 ]
1435- if self .shape == 'right' :
1436+ if self ._shape == 'right' :
14361437 coords = right_half_arrow
1437- elif self .shape == 'full' :
1438+ elif self ._shape == 'full' :
14381439 # The half-arrows contain the midpoint of the stem,
14391440 # which we can omit from the full arrow. Including it
14401441 # twice caused a problem with xpdf.
@@ -1443,15 +1444,15 @@ def _make_verts(self):
14431444 else :
14441445 raise ValueError ("Got unknown shape: %s" % self .shape )
14451446 if distance != 0 :
1446- cx = self .dx / distance
1447- sx = self .dy / distance
1447+ cx = self ._dx / distance
1448+ sx = self ._dy / distance
14481449 else :
14491450 # Account for division by zero
14501451 cx , sx = 0 , 1
14511452 M = [[cx , sx ], [- sx , cx ]]
14521453 self .verts = np .dot (coords , M ) + [
1453- self .x + self .dx ,
1454- self .y + self .dy ,
1454+ self ._x + self ._dx ,
1455+ self ._y + self ._dy ,
14551456 ]
14561457
14571458
0 commit comments