Skip to content

Commit

Permalink
Fix CoordinateSystem init bug
Browse files Browse the repository at this point in the history
  • Loading branch information
3b1b committed Aug 24, 2021
1 parent acba13f commit 8645894
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions manimlib/mobject/coordinate_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from manimlib.mobject.number_line import NumberLine
from manimlib.mobject.svg.tex_mobject import Tex
from manimlib.mobject.types.vectorized_mobject import VGroup
from manimlib.utils.config_ops import digest_config
from manimlib.utils.config_ops import merge_dicts_recursively
from manimlib.utils.simple_functions import binary_search
from manimlib.utils.space_ops import angle_of_vector
Expand All @@ -27,11 +28,16 @@ class CoordinateSystem():
"dimension": 2,
"default_x_range": [-8.0, 8.0, 1.0],
"default_y_range": [-4.0, 4.0, 1.0],
"width": None,
"height": None,
"width": FRAME_WIDTH,
"height": FRAME_HEIGHT,
"num_sampled_graph_points_per_tick": 20,
}

def __init__(self, **kwargs):
digest_config(self, kwargs)
self.x_range = np.array(self.default_x_range)
self.y_range = np.array(self.default_y_range)

def coords_to_point(self, *coords):
raise Exception("Not implemented")

Expand Down Expand Up @@ -282,12 +288,12 @@ def __init__(self,
x_range=None,
y_range=None,
**kwargs):
super().__init__(**kwargs)
CoordinateSystem.__init__(self, **kwargs)
VGroup.__init__(self, **kwargs)

if x_range is not None:
self.x_range = np.array(self.default_x_range)
self.x_range[:len(x_range)] = x_range
if y_range is not None:
self.y_range = np.array(self.default_y_range)
self.y_range[:len(y_range)] = y_range

self.x_axis = self.create_axis(
Expand Down

0 comments on commit 8645894

Please sign in to comment.