All skills
adithya-s-k avatar

/manimce-best-practices

@6668663
by Adithya S Kadithya-s-k/manim_skill1.1k stars
94

Trigger when: (1) User mentions "manim" or "Manim Community" or "ManimCE", (2) Code contains `from manim import *`, (3) User runs `manim` CLI commands, (4) Working with Scene, MathTex, Create(), or ManimCE-specific classes. Best practices for Manim Community Edition - the community-maintained Python animation engine. Covers Scene structure, animations, LaTeX/MathTex, 3D with ThreeDScene, camera control, styling, and CLI usage. NOT for ManimGL/3b1b version (which uses `manimlib` imports and `manimgl` CLI).

Use this Skill: https://skilld.dev/gh/adithya-s-k/manim_skill/manimce-best-practices

This session only. Nothing lands on disk.

rulesaxes.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Coordinate Systems

Create axes, grids, and number lines for mathematical visualizations.

Axes

Basic 2D coordinate axes.

from manim import *

class AxesExample(Scene):
    def construct(self):
        # Default axes
        axes = Axes()
        self.add(axes)

Customizing Axes

class CustomAxes(Scene):
    def construct(self):
        axes = Axes(
            x_range=[-5, 5, 1],      # [min, max, step]
            y_range=[-3, 3, 1],
            x_length=10,              # Physical length on screen
            y_length=6,
            axis_config={
                "color": BLUE,
                "include_tip": True,
                "include_numbers": True,
            },
            x_axis_config={
                "numbers_to_include": [-4, -2, 0, 2, 4],
            },
            y_axis_config={
                "numbers_to_include": [-2, 0, 2],
            },
        )
        self.add(axes)

Adding Labels

class AxesLabels(Scene):
    def construct(self):
        axes = Axes(x_range=[-5, 5], y_range=[-3, 3])

        # Add axis labels
        x_label = axes.get_x_axis_label("x")
        y_label = axes.get_y_axis_label("y")

        # Custom labels
        x_label = axes.get_x_axis_label(MathTex(r"\theta"))
        y_label = axes.get_y_axis_label(MathTex(r"f(\theta)"))

        self.add(axes, x_label, y_label)

NumberPlane

Grid with axes - shows coordinate lines.

class NumberPlaneExample(Scene):
    def construct(self):
        # Default plane
        plane = NumberPlane()
        self.add(plane)

Customizing NumberPlane

class CustomPlane(Scene):
    def construct(self):
        plane = NumberPlane(
            x_range=[-4, 4, 1],
            y_range=[-3, 3, 1],
            x_length=8,
            y_length=6,
            background_line_style={
                "stroke_color": BLUE_D,
                "stroke_width": 1,
                "stroke_opacity": 0.5,
            },
            axis_config={
                "color": WHITE,
            },
        )
        self.add(plane)

ComplexPlane

For visualizing complex numbers.

class ComplexPlaneExample(Scene):
    def construct(self):
        plane = ComplexPlane()

        # Plot complex number
        z = complex(2, 1)  # 2 + i
        dot = Dot(plane.n2p(z), color=YELLOW)
        label = MathTex("2+i").next_to(dot, UR)

        self.add(plane, dot, label)

NumberLine

Single axis line.

class NumberLineExample(Scene):
    def construct(self):
        line = NumberLine(
            x_range=[-5, 5, 1],
            length=10,
            include_numbers=True,
            include_tip=True,
        )
        self.add(line)

Coordinate Conversions

class CoordinateConversion(Scene):
    def construct(self):
        axes = Axes(x_range=[-5, 5], y_range=[-3, 3])

        # Convert coordinates to screen position
        point = axes.c2p(2, 1)  # coords_to_point: (2, 1) -> screen position

        # Convert screen position to coordinates
        coords = axes.p2c(point)  # point_to_coords: screen -> (x, y)

        dot = Dot(point, color=RED)
        self.add(axes, dot)

Shorthand Methods

axes = Axes()

# c2p = coords_to_point
axes.c2p(x, y)

# p2c = point_to_coords
axes.p2c(point)

# i2gp = input_to_graph_point (for graphs)
axes.i2gp(x, graph)

# For NumberPlane/ComplexPlane
plane.n2p(complex_number)  # number_to_point
plane.p2n(point)           # point_to_number

ThreeDAxes

For 3D visualizations.

class ThreeDAxesExample(ThreeDScene):
    def construct(self):
        axes = ThreeDAxes(
            x_range=[-4, 4, 1],
            y_range=[-4, 4, 1],
            z_range=[-4, 4, 1],
            x_length=8,
            y_length=8,
            z_length=6,
        )

        self.set_camera_orientation(phi=75 * DEGREES, theta=-45 * DEGREES)
        self.add(axes)

Plotting Points

class PlotPoints(Scene):
    def construct(self):
        axes = Axes(x_range=[-5, 5], y_range=[-3, 3])

        points = [(1, 2), (-2, 1), (3, -1), (0, 2)]
        dots = VGroup(*[
            Dot(axes.c2p(x, y), color=YELLOW)
            for x, y in points
        ])

        self.add(axes, dots)

Best Practices

  1. Set appropriate ranges - Don't include unnecessary empty space
  2. Match x_length/y_length to range ratio - Prevents distortion
  3. Use NumberPlane for transformations - Grid shows distortion clearly
  4. Use c2p for all coordinate work - Don't manually convert
  5. Include numbers sparingly - Too many numbers clutter the display

Source: SKILL.md on GitHub

No alerts17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill is a comprehensive educational resource for the Manim Community Edition library. It provides best practices, templates, and example scripts for creating mathematical animations and visualizations. No security risks or malicious patterns were identified.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer7mo

    37 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 6668663. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 8 months ago
  • Python
  • manim
  • animation
  • latex
  • mathtex
  • 3d
  • rendering
  • scene
  • visualization

README badge

README badge for adithya-s-k/manim_skill/manimce-best-practices

Provides best practices and patterns for Manim Community Edition, the Python animation library for mathematical visualizations. Covers Scene structure, animations, LaTeX rendering, 3D graphics, positioning, and CLI usage with organized rule files, working examples, and templates.

Generated from the current SKILL.md.

Does this skill cover ManimGL or just Manim Community Edition?
Only Manim Community Edition (ManimCE). It does not apply to ManimGL/3b1b version, which uses `manimlib` imports and the `manimgl` CLI instead.
What topics are included in this skill?
Scene structure, mobjects, animations (creation, transformation, groups), text and LaTeX rendering, styling, positioning, 3D visualization, timing and updaters, camera control, CLI usage, and common geometric shapes.
Does this skill include working examples?
Yes. It includes five complete example files demonstrating basic animations, math visualization, updater patterns, graph plotting, and 3D visualization, plus three scene templates for 2D, camera-controlled, and 3D scenes.
What should I do if text rendering fails in my Manim scripts?
Check your manimpango installation requirements, as text rendering failures often stem from manimpango configuration issues. The skill also recommends running `manim checkhealth` to verify your overall installation.
How do I render a scene with different quality levels?
Use quality flags with the manim CLI: `-ql` for low quality (fast, development), `-qm` for medium, `-qh` for high, and `-qk` for 4K. For example: `manim -pqh scene.py MyScene`.

Generated from the current SKILL.md. These answers refresh after source changes.