@@ -1464,13 +1464,24 @@ def is_dashed(self):
14641464 return self ._linestyle in ('--' , '-.' , ':' )
14651465
14661466
1467- class _AxLine (Line2D ):
1467+ class AxLine (Line2D ):
14681468 """
14691469 A helper class that implements `~.Axes.axline`, by recomputing the artist
14701470 transform at draw time.
14711471 """
14721472
14731473 def __init__ (self , xy1 , xy2 , slope , ** kwargs ):
1474+ """
1475+ Parameters
1476+ ----------
1477+ xy1 : (float, float)
1478+ The first set of (x, y) coordinates for the line to pass through.
1479+ xy2 : (float, float) or None
1480+ The second set of (x, y) coordinates for the line to pass through.
1481+ Either *xy2* or *slope* has to be given.
1482+ slope : float or None
1483+ The slope of the line. Either *xy2* or *slope* has to be given.
1484+ """
14741485 super ().__init__ ([0 , 1 ], [0 , 1 ], ** kwargs )
14751486
14761487 if (xy2 is None and slope is None or
@@ -1527,6 +1538,65 @@ def draw(self, renderer):
15271538 self ._transformed_path = None # Force regen.
15281539 super ().draw (renderer )
15291540
1541+ def get_xy1 (self ):
1542+ """
1543+ Return the *xy1* value of the line.
1544+ """
1545+ return self ._xy1
1546+
1547+ def get_xy2 (self ):
1548+ """
1549+ Return the *xy2* value of the line.
1550+ """
1551+ return self ._xy2
1552+
1553+ def get_slope (self ):
1554+ """
1555+ Return the *slope* value of the line.
1556+ """
1557+ return self ._slope
1558+
1559+ def set_xy1 (self , x , y ):
1560+ """
1561+ Set the *xy1* value of the line.
1562+
1563+ Parameters
1564+ ----------
1565+ x, y : (float, float)
1566+ Points for the line to pass through.
1567+ """
1568+ self ._xy1 = x , y
1569+
1570+ def set_xy2 (self , x , y ):
1571+ """
1572+ Set the *xy2* value of the line.
1573+
1574+ Parameters
1575+ ----------
1576+ x, y : (float, float)
1577+ Points for the line to pass through.
1578+ """
1579+ if self ._slope is None :
1580+ self ._xy2 = x , y
1581+ else :
1582+ raise ValueError ("Cannot set an 'xy2' value while 'slope' is set;"
1583+ " they differ but their functionalities overlap" )
1584+
1585+ def set_slope (self , slope ):
1586+ """
1587+ Set the *slope* value of the line.
1588+
1589+ Parameters
1590+ ----------
1591+ slope : float
1592+ The slope of the line.
1593+ """
1594+ if self ._xy2 is None :
1595+ self ._slope = slope
1596+ else :
1597+ raise ValueError ("Cannot set a 'slope' value while 'xy2' is set;"
1598+ " they differ but their functionalities overlap" )
1599+
15301600
15311601class VertexSelector :
15321602 """
0 commit comments