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,
|
direction=RIGHT,
|
||||||
buff=MED_SMALL_BUFF,
|
buff=MED_SMALL_BUFF,
|
||||||
color=None):
|
color=None):
|
||||||
label = Tex(label)
|
if isinstance(label, str):
|
||||||
|
label = Tex(label)
|
||||||
if color is None:
|
if color is None:
|
||||||
label.match_color(graph)
|
label.match_color(graph)
|
||||||
if x is None:
|
if x is None:
|
||||||
# Searching from the right, find a point
|
# Searching from the right, find a point
|
||||||
# whose y value is in bounds
|
# whose y value is in bounds
|
||||||
max_y = FRAME_Y_RADIUS - label.get_height()
|
max_y = FRAME_Y_RADIUS - label.get_height()
|
||||||
for x0 in np.arange(*self.x_range)[-1::-1]:
|
max_x = FRAME_X_RADIUS - label.get_width()
|
||||||
if abs(self.itgp(x0, graph)[1]) < max_y:
|
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
|
x = x0
|
||||||
break
|
break
|
||||||
if x is None:
|
if x is None:
|
||||||
|
|
Loading…
Add table
Reference in a new issue