mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Some changes to get_graph_label defaults
This commit is contained in:
parent
c3ccfbfa65
commit
e6fc323b6d
1 changed files with 6 additions and 3 deletions
|
@ -147,15 +147,18 @@ class CoordinateSystem():
|
|||
direction=RIGHT,
|
||||
buff=MED_SMALL_BUFF,
|
||||
color=None):
|
||||
label = Tex(label)
|
||||
if isinstance(label, str):
|
||||
label = Tex(label)
|
||||
if color is None:
|
||||
label.match_color(graph)
|
||||
if x is None:
|
||||
# Searching from the right, find a point
|
||||
# whose y value is in bounds
|
||||
max_y = FRAME_Y_RADIUS - label.get_height()
|
||||
for x0 in np.arange(*self.x_range)[-1::-1]:
|
||||
if abs(self.itgp(x0, graph)[1]) < max_y:
|
||||
max_x = FRAME_X_RADIUS - label.get_width()
|
||||
for x0 in np.arange(*self.x_range)[::-1]:
|
||||
pt = self.itgp(x0, graph)
|
||||
if abs(pt[0]) < max_x and abs(pt[1]) < max_y:
|
||||
x = x0
|
||||
break
|
||||
if x is None:
|
||||
|
|
Loading…
Add table
Reference in a new issue