def add_background_plane(self): background = NumberPlane(**self.plane_config).fade( self.background_fade_factor ) real_labels = VGroup(*[ TexMobject(str(x)).shift( background.num_pair_to_point((x, 0)) ) for x in range(-int(background.x_radius), int(background.x_radius)) ]) imag_labels = VGroup(*[ TexMobject("%di"%y).shift( background.num_pair_to_point((0, y)) ) for y in range(-int(background.y_radius), int(background.y_radius)) if y != 0 ]) for labels in real_labels, imag_labels: for label in labels: label.scale_in_place(self.background_label_scale_val) label.next_to(label.get_center(), DOWN+LEFT, buff = SMALL_BUFF) label.add_background_rectangle() background.add(labels) self.real_labels = real_labels self.imag_labels = imag_labels self.add(background) self.background = background
def __init__(self, **kwargs): digest_config(self, kwargs) kwargs.update({ "x_unit_size": self.unit_size, "y_unit_size": self.unit_size, "x_line_frequency": self.line_frequency, "x_faded_line_frequency": self.faded_line_frequency, "y_line_frequency": self.line_frequency, "y_faded_line_frequency": self.faded_line_frequency, }) NumberPlane.__init__(self, **kwargs)
def __init__(self, **kwargs): digest_config(self, kwargs) kwargs.update({ "x_unit_to_spatial_width" : self.unit_to_spatial_width, "y_unit_to_spatial_height" : self.unit_to_spatial_width, "x_line_frequency" : self.line_frequency, "x_faded_line_frequency" : self.faded_line_frequency, "y_line_frequency" : self.line_frequency, "y_faded_line_frequency" : self.faded_line_frequency, "num_pair_at_center" : (self.number_at_center.real, self.number_at_center.imag), }) NumberPlane.__init__(self, **kwargs)
def add_transformable_plane(self, animate = False): self.plane_config.update({ "x_radius" : (self.x_max - self.x_min)/2., "y_radius" : (self.y_max - self.y_min)/2., }) plane = NumberPlane(**self.plane_config) plane.shift( (self.x_max+self.x_min)*RIGHT/2., (self.y_max+self.y_min)*UP/2., ) self.paint_plane(plane) if animate: self.play(ShowCreation(plane, run_time = 2)) else: self.add(plane) self.plane = plane