fix: align throughput bars by same-x positioning instead of arrange Left-edge
This commit is contained in:
parent
ce2a7c165a
commit
f6ccefb34e
|
|
@ -288,9 +288,6 @@ class ContinuousBatching(Scene):
|
||||||
.align_to(s_rect, LEFT).align_to(s_rect, UP)
|
.align_to(s_rect, LEFT).align_to(s_rect, UP)
|
||||||
s_num = Text("1.0x", font_size=24, color=RED)
|
s_num = Text("1.0x", font_size=24, color=RED)
|
||||||
|
|
||||||
s_label.next_to(s_rect, LEFT, buff=0.4)
|
|
||||||
s_num.next_to(s_rect, RIGHT, buff=0.4)
|
|
||||||
|
|
||||||
# ---- Continuous Batching row ----
|
# ---- Continuous Batching row ----
|
||||||
c_label = Text("Continuous Batching", font_size=24, color=GREEN)
|
c_label = Text("Continuous Batching", font_size=24, color=GREEN)
|
||||||
c_rect = Rectangle(width=bar_max_w, height=bar_h, color=GREEN, stroke_width=1.5)
|
c_rect = Rectangle(width=bar_max_w, height=bar_h, color=GREEN, stroke_width=1.5)
|
||||||
|
|
@ -299,15 +296,15 @@ class ContinuousBatching(Scene):
|
||||||
.align_to(c_rect, LEFT).align_to(c_rect, UP)
|
.align_to(c_rect, LEFT).align_to(c_rect, UP)
|
||||||
c_num = Text("3.4x", font_size=24, color=GREEN)
|
c_num = Text("3.4x", font_size=24, color=GREEN)
|
||||||
|
|
||||||
c_label.next_to(c_rect, LEFT, buff=0.4)
|
# position rects vertically stacked, same x
|
||||||
c_num.next_to(c_rect, RIGHT, buff=0.4)
|
s_rect.move_to(ORIGIN + UP * (row_gap / 2 + bar_h / 2))
|
||||||
|
c_rect.move_to(ORIGIN + DOWN * (row_gap / 2 + bar_h / 2))
|
||||||
|
|
||||||
# stack rows, centre vertically
|
# labels left, nums right, bars follow rects
|
||||||
chart = VGroup(
|
s_label.next_to(s_rect, LEFT, buff=0.4)
|
||||||
VGroup(s_label, s_rect, s_bar, s_num),
|
c_label.next_to(c_rect, LEFT, buff=0.4)
|
||||||
VGroup(c_label, c_rect, c_bar, c_num),
|
s_num.next_to(s_rect, RIGHT, buff=0.4)
|
||||||
)
|
c_num.next_to(c_rect, RIGHT, buff=0.4)
|
||||||
chart.arrange(DOWN, buff=row_gap, aligned_edge=LEFT).move_to(ORIGIN)
|
|
||||||
|
|
||||||
self.play(
|
self.play(
|
||||||
Create(s_rect), Create(c_rect),
|
Create(s_rect), Create(c_rect),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue