def show_piecewise_constant_graph(self):
    pw_constant_graph = self.get_pw_constant_graph()
    alt_lines = [line.copy().set_color(YELLOW) for line in pw_constant_graph[:4]]
    for line in alt_lines:
        line.start_dot = Dot(line.get_start())
        line.end_dot = Dot(line.get_end())
        VGroup(line.start_dot, line.end_dot).set_color(line.get_color())
    line = alt_lines[0]
    faders = [self.v_graph, self.v_graph_label]
    for mob in faders:
        mob.save_state()
        mob.generate_target()
        mob.target.fade(0.7)
    self.play(*list(map(MoveToTarget, faders)))
    self.play(ShowCreation(pw_constant_graph, run_time=2))
    self.wait()
    self.play(ShowCreation(line))
    self.wait()
    for new_line in alt_lines[1:]:
        for mob in (line.end_dot, new_line.start_dot, new_line):
            self.play(Transform(line, mob, run_time=(1.0 / 3)))
        self.remove(line)
        self.add(new_line)
        self.wait(2)
        line = new_line
    self.play(FadeOut(line))
    self.pw_constant_graph = pw_constant_graph
def show_piecewise_constant_graph(self):
    pw_constant_graph = self.get_pw_constant_graph()
    alt_lines = [line.copy().set_color(YELLOW) for line in pw_constant_graph[:4]]
    for line in alt_lines:
        line.start_dot = Dot(line.get_start())
        line.end_dot = Dot(line.get_end())
        VGroup(line.start_dot, line.end_dot).set_color(line.get_color())
    line = alt_lines[0]
    faders = [self.v_graph, self.v_graph_label]
    for mob in faders:
        mob.save_state()
        mob.generate_target()
        mob.target.fade(0.7)
    self.play(*list(map(MoveToTarget, faders)))
    self.play(ShowCreation(pw_constant_graph, run_time=2))
    self.wait()
    self.play(ShowCreation(line))
    self.wait()
    for new_line in alt_lines[1:]:
        for mob in (line.end_dot, new_line.start_dot, new_line):
            self.play(Transform(line, mob, run_time=(1.0 / 3)))
        self.remove(line)
        self.add(new_line)
        self.wait(2)
        line = new_line
    self.play(FadeOut(line))
    self.pw_constant_graph = pw_constant_graph