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

Code before:
        lines2 = VGroup()
        unit_vector_axis_perp_to = axis_perpendicular_to.get_unit_vector()

        # If they're not on different sides then their product is positive or 0
        on_same_side = axis_perpendicular_to.x_max * axis_perpendicular_to.x_min > 0

        if on_same_side:
            if axis_perpendicular_to.x_max >= 0:
                # Both on positive side
                positive_end_point = (
                    axis_perpendicular_to.x_max - axis_perpendicular_to.x_min
                )
                ranges = (np.arange(0, positive_end_point, step),)
            else:
                # Both on negative side
                negative_end_point = (
                    axis_perpendicular_to.x_min - axis_perpendicular_to.x_max
                )
                ranges = (np.arange(0, negative_end_point, -step),)
        else:
            # On different sides
            ranges = (
                np.arange(0, axis_perpendicular_to.x_max, step),
                np.arange(0, axis_perpendicular_to.x_min, -step),
            )

        for inputs in ranges:
            for k, x in enumerate(inputs):
                new_line = line.copy()
                new_line.shift(unit_vector_axis_perp_to * x)
                if k % ratio_faded_lines == 0:
                    lines1.add(new_line)
                else:
                    lines2.add(new_line)
        return lines1, lines2

    def get_center_point(self) -> np.ndarray:
        """Gets the origin of :class:`NumberPlane`.

        Returns
        -------
        np.ndarray
            The center point.
        """
        return self.coords_to_point(0, 0)

    def get_x_unit_size(self):
        return self.get_x_axis().get_unit_size()

    def get_y_unit_size(self):
        return self.get_x_axis().get_unit_size()

Review comment (refactor):
I think using max/min can simplify the logic. (black really did a number on this formatting) 
```suggestion

        # min/max used in case range does not include 0. i.e. if (2,6):
        # the range becomes (0,4), not (0,6), to produce the corrent amount of lines
        ranges = (
            np.arange(
                0,
                min(
                    axis_perpendicular_to.x_range[1] - axis_perpendicular_to.x_range[0],
                    axis_perpendicular_to.x_range[1],
                ),
                step,
            ),
            np.arange(
                0,
                max(
                    axis_perpendicular_to.x_range[0] - axis_perpendicular_to.x_range[1],
                    axis_perpendicular_to.x_range[0],
                ),
                -step,
            ),
        )

```

Code after:
    ) -> Tuple[VGroup, VGroup]:
        """Generate a set of lines parallel to an axis.

        Parameters
        ----------
        axis_parallel_to
            The axis with which the lines will be parallel.

        axis_perpendicular_to
            The axis with which the lines will be perpendicular.

        ratio_faded_lines
            The ratio between the space between faded lines and the space between non-faded lines.

        freq
            Frequency of non-faded lines (number of non-faded lines per graph unit).

        Returns
        -------
        Tuple[:class:`~.VGroup`, :class:`~.VGroup`]
            The first (i.e the non-faded lines parallel to `axis_parallel_to`) and second (i.e the faded lines parallel to `axis_parallel_to`) sets of lines, respectively.
        """

        line = Line(axis_parallel_to.get_start(), axis_parallel_to.get_end())
        if ratio_faded_lines == 0:  # don't show faded lines
            ratio_faded_lines = 1  # i.e. set ratio to 1
        step = (1 / ratio_faded_lines) * freq
        lines1 = VGroup()
        lines2 = VGroup()
        unit_vector_axis_perp_to = axis_perpendicular_to.get_unit_vector()

        # min/max used in case range does not include 0. i.e. if (2,6):
        # the range becomes (0,4), not (0,6), to produce the correct number of lines
        ranges = (
            np.arange(
                0,
                min(
                    axis_perpendicular_to.x_max - axis_perpendicular_to.x_min,
                    axis_perpendicular_to.x_max,
                ),
                step,
            ),
            np.arange(
                0,
                max(
                    axis_perpendicular_to.x_min - axis_perpendicular_to.x_max,
                    axis_perpendicular_to.x_min,
                ),
                -step,
            ),
        )