Sorting bars

Sorting bars preview
remixableManimCE2Dalgorithmsloop

manim/sorting_bars.py

"""Sorting bars: thirty bars put in order by quicksort, one run to the end.

Render (the driver does this for every palette; these are for eyeballing):
    P=/opt/homebrew/opt/python@3.11/bin/python3.11
    ASSET_MODE=still  $P -m manim -s -t -r 1600,1600 manim/sorting_bars.py SortingBars
    ASSET_MODE=motion $P -m manim -qh   -r 1600,1600 manim/sorting_bars.py SortingBarsLoop
"""

import numpy as np
from manim import (
    DOWN,
    LEFT,
    RIGHT,
    UP,
    NumberPlane,
    Rectangle,

The full Manim source and the rendered video come with a plan.