Repository: ManimCommunity/manim
File: manim/mobject/coordinate_systems.py (Python)

Code before:
    CONFIG = {
        "axis_config": {
            "color": LIGHT_GREY,
            "include_tip": True,
            "exclude_zero_from_default_numbers": True,
        },
        "x_axis_config": {},
        "y_axis_config": {"label_direction": LEFT},
        "center_point": ORIGIN,
    }

    def __init__(self, **kwargs):
        CoordinateSystem.__init__(self)
        VGroup.__init__(self, **kwargs)
        self.x_axis = self.create_axis(self.x_min, self.x_max, self.x_axis_config)
        self.y_axis = self.create_axis(self.y_min, self.y_max, self.y_axis_config)
        self.y_axis.rotate(90 * DEGREES, about_point=ORIGIN)
        # Add as a separate group in case various other
        # mobjects are added to self, as for example in
        # NumberPlane below
        self.axes = VGroup(self.x_axis, self.y_axis)
        self.add(*self.axes)
        self.shift(self.center_point)
        ynums = self.y_axis.numbers
        for num in range(len(ynum)):
            self.y_axis.numbers[num].rotate(-90 * DEGREES)

    def create_axis(self, min_val, max_val, axis_config):
        new_config = merge_dicts_recursively(
            self.axis_config,
            {"x_min": min_val, "x_max": max_val},
            axis_config,
        )
        return NumberLine(**new_config)

    def coords_to_point(self, *coords):
        origin = self.x_axis.number_to_point(0)
        result = np.array(origin)
        for axis, coord in zip(self.get_axes(), coords):
            result += axis.number_to_point(coord) - origin
        return result

    def c2p(self, *coords):
        return self.coords_to_point(*coords)

    def point_to_coords(self, point):
        return tuple([axis.point_to_number(point) for axis in self.get_axes()])

    def p2c(self, point):
        return self.point_to_coords(point)


Review comment (suggestion):
We actually don't need to introduce this local variable there:

```suggestion
        for num in self.y_axis.numbers:
            num.rotate(-90 * DEGREES)
```

Code after:
        self,
        axis_config=None,
        x_axis_config=None,
        y_axis_config=None,
        center_point=ORIGIN,
        **kwargs
    ):
        if axis_config is None:
            axis_config = {
                "color": LIGHT_GREY,
                "include_tip": True,
                "exclude_zero_from_default_numbers": True,
            }
        if y_axis_config is None:
            y_axis_config = {"label_direction": LEFT, "rotation": 90 * DEGREES}
        self.axis_config = axis_config
        if x_axis_config is None:
            x_axis_config = {}
        self.x_axis_config = x_axis_config
        self.y_axis_config = y_axis_config
        self.center_point = center_point
        CoordinateSystem.__init__(self)
        VGroup.__init__(self, **kwargs)
        self.x_axis = self.create_axis(self.x_min, self.x_max, self.x_axis_config)
        self.y_axis = self.create_axis(self.y_min, self.y_max, self.y_axis_config)
        # Add as a separate group in case various other
        # mobjects are added to self, as for example in
        # NumberPlane below
        self.axes = VGroup(self.x_axis, self.y_axis, dim=self.dim)
        self.add(*self.axes)
        self.shift(self.center_point)

    def create_axis(self, min_val, max_val, axis_config):
        new_config = merge_dicts_recursively(
            self.axis_config,
            {"x_min": min_val, "x_max": max_val},
            axis_config,
        )
        return NumberLine(**new_config)

    def coords_to_point(self, *coords):
        origin = self.x_axis.number_to_point(0)
        result = np.array(origin)
        for axis, coord in zip(self.get_axes(), coords):
            result += axis.number_to_point(coord) - origin
        return result

    def c2p(self, *coords):
        return self.coords_to_point(*coords)

    def point_to_coords(self, point):