@@ -943,6 +943,30 @@ def construct(self):
943943 f"x={ x } not located in the range of the graph ([{ self .p2c (graph .get_start ())[0 ]} , { self .p2c (graph .get_end ())[0 ]} ])" ,
944944 )
945945
946+ def input_to_graph_coords (self , x : float , graph : "ParametricFunction" ) -> Tuple :
947+ """
948+ Returns a tuple of the axis relative coordinates of the point
949+ on the graph based on the x-value given.
950+
951+ Examples
952+ --------
953+
954+ .. code-block:: pycon
955+
956+ >>> from manim import Axes
957+ >>> ax = Axes()
958+ >>> parabola = ax.plot(lambda x: x ** 2)
959+ >>> ax.input_to_graph_coords(x=3, graph=parabola)
960+ (3, 9)
961+ """
962+ return x , graph .underlying_function (x )
963+
964+ def i2gc (self , x : float , graph : "ParametricFunction" ) -> Tuple :
965+ """
966+ Alias for :meth:`input_to_graph_coords`.
967+ """
968+ return self .input_to_graph_coords (x , graph )
969+
946970 def i2gp (self , x : float , graph : "ParametricFunction" ) -> np .ndarray :
947971 """
948972 Alias for :meth:`input_to_graph_point`.
@@ -1313,7 +1337,7 @@ def angle_of_tangent(
13131337 ax = Axes()
13141338 curve = ax.plot(lambda x: x ** 2)
13151339 ax.angle_of_tangent(x=3, graph=curve)
1316- # 1.3825747960950903
1340+ # 1.4056476493802699
13171341
13181342
13191343 Parameters
@@ -1331,8 +1355,8 @@ def angle_of_tangent(
13311355 The angle of the tangent to the curve.
13321356 """
13331357
1334- p0 = self .input_to_graph_point (x , graph )
1335- p1 = self .input_to_graph_point (x + dx , graph )
1358+ p0 = np . array ([ * self .input_to_graph_coords (x , graph )] )
1359+ p1 = np . array ([ * self .input_to_graph_coords (x + dx , graph )] )
13361360 return angle_of_vector (p1 - p0 )
13371361
13381362 def slope_of_tangent (
0 commit comments