Exemplo n.º 1
0
 def get_graph_label(
     self,
     graph,
     label="f(x)",
     x_val=None,
     direction=consts.RIGHT,
     buff=consts.MED_SMALL_BUFF,
     color=None,
 ):
     label = TexMobject(label)
     color = color or graph.get_color()
     label.set_color(color)
     if x_val is None:
         # Search from right to left
         for x in np.linspace(self.x_max, self.x_min, 100):
             point = self.input_to_graph_point(x, graph)
             if point[1] < consts.FRAME_Y_RADIUS:
                 break
         x_val = x
     label.next_to(
         self.input_to_graph_point(x_val, graph),
         direction,
         buff=buff
     )
     label.shift_onto_screen()
     return label
Exemplo n.º 2
0
 def get_axis_label(self,
                    label_tex,
                    axis,
                    edge,
                    direction,
                    buff=consts.MED_SMALL_BUFF):
     label = TexMobject(label_tex)
     label.next_to(axis.get_edge_center(edge), direction, buff=buff)
     label.shift_onto_screen(buff=consts.MED_SMALL_BUFF)
     return label