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

Code before:
    .. manim:: DashedVMobjectExample
        :save_last_frame:

        class DashedVMobjectExample(Scene):
            def construct(self):
                r = 0.5
                pos = 2.5 * UP + 6 * LEFT  # Tracker for position on screen
                # Top Row: Increases the number of dashes per iteration
                for dashes in range(2, 12):  # [2 , ..., 11]
                    circ = DashedVMobject(Circle(radius=r, color=WHITE), num_dashes=dashes).move_to(pos)
                    self.add(circ)
                    pos += 1.25 * RIGHT

                # Middle Row: Increasing Positive Space Ratio per iteration
                pos = 0.5 * UP + 6 * LEFT  # Reset Position
                for ratio in np.arange(1 / 11, 1, 1 / 11):  # [1/11 , ..., 10/11, 1]
                    circ = DashedVMobject(Circle(radius=r, color=WHITE), positive_space_ratio=ratio).move_to(pos)
                    self.add(circ)
                    pos += 1.25 * RIGHT

                # Bottom Row: Different Colors(Square and Pentagon)
                # Square
                pos = 1.5 * DOWN + 1.25 * LEFT  # Reset Position
                sq = DashedVMobject(Square(1.5, color=RED)).move_to(pos)

                # Pentagon
                pos += 2.5 * RIGHT
                penta = DashedVMobject(RegularPolygon(5, color=BLUE)).move_to(pos)

                self.add(sq, penta)

    """

    def __init__(
        self, vmobject, num_dashes=15, positive_space_ratio=0.5, color=WHITE, **kwargs
    ):
        self.num_dashes = num_dashes
        self.positive_space_ratio = positive_space_ratio
        super().__init__(color=color, **kwargs)
        ps_ratio = self.positive_space_ratio
        if num_dashes > 0:
            # End points of the unit interval for division
            alphas = np.linspace(0, 1, num_dashes + 1)

            # This determines the length of each "dash"
            full_d_alpha = 1.0 / num_dashes
            partial_d_alpha = full_d_alpha * ps_ratio

            # Shifts the alphas and removes the last dash
            # to give closed shapes even spacing
            if vmobject.is_closed():

Review comment (suggestion):
Spelling out Square and Pentagon seems unnecessary 
```suggestion
                pos = 1.5 * DOWN + 1.25 * LEFT  # Reset Position
                sq = DashedVMobject(Square(1.5, color=RED)).move_to(pos)

```

Code after:
    .. manim:: DashedVMobjectExample
        :save_last_frame:

        class DashedVMobjectExample(Scene):
            def construct(self):
                r = 0.5

                top_row = VGroup()  # Increasing num_dashes
                for dashes in range(2, 12):
                    circ = DashedVMobject(Circle(radius=r, color=WHITE), num_dashes=dashes)
                    top_row.add(circ)

                middle_row = VGroup()  # Increasing positive_space_ratio
                for ratio in np.arange(1 / 11, 1, 1 / 11):
                    circ = DashedVMobject(
                        Circle(radius=r, color=WHITE), positive_space_ratio=ratio
                    )
                    middle_row.add(circ)

                sq = DashedVMobject(Square(1.5, color=RED))
                penta = DashedVMobject(RegularPolygon(5, color=BLUE))
                bottom_row = VGroup(sq, penta)

                top_row.arrange(buff=0.4)
                middle_row.arrange()
                bottom_row.arrange(buff=1)
                everything = VGroup(top_row, middle_row, bottom_row).arrange(DOWN, buff=1)
                self.add(everything)

    """

    def __init__(
        self, vmobject, num_dashes=15, positive_space_ratio=0.5, color=WHITE, **kwargs
    ):
        self.num_dashes = num_dashes
        self.positive_space_ratio = positive_space_ratio
        super().__init__(color=color, **kwargs)
        ps_ratio = self.positive_space_ratio
        if num_dashes > 0:
            # End points of the unit interval for division
            alphas = np.linspace(0, 1, num_dashes + 1)

            # This determines the length of each "dash"
            full_d_alpha = 1.0 / num_dashes
            partial_d_alpha = full_d_alpha * ps_ratio

            # Shifts the alphas and removes the last dash
            # to give closed shapes even spacing
            if vmobject.is_closed():
                alphas += partial_d_alpha / 2
                np.delete(alphas, -1)