Skip to content

Axes

Axes Parameters#

Paremeters - as mentioned in 3b1b Manim Documentation - are:

  • Constructor : Axes

  • Parameters :

  • (x-min, x-max)
  • (y-min, y-max)

Labeled Axes#

from manimlib import *

class AxesWithLabel(Scene):
    def construct(self):
        axeswithlabel = Axes((-1,10), (-1,8))
        axeswithlabel.add_coordinate_labels()
        self.play(Write(axeswithlabel, lag_ratio=0.01, run_time=5))
from manim import *

class AxesWithLabel(Scene):
    def construct(self):
        ax = Axes(x_range=[0, 10], y_range=[0, 10], axis_config={"include_tip": True}).add_coordinates()
        labels = ax.get_axis_labels(x_label="x", y_label="y")
        self.play(Create(ax))
        self.play(Write(labels))
        self.wait(2)

Preview:#

Non-Labeled Axes#

from manimlib import *

class AxesWithoutLabel(Scene):
    def construct(self):
        axeswithoutlabel = Axes((-1,10), (-1,8))
        self.play(Write(axeswithoutlabel, lag_ratio=0.01, run_time=5))
from manim import *

class AxesWithoutLabel(Scene):
    def construct(self):
        ax = Axes(x_range=[0, 10], y_range=[0, 10], axis_config={"include_tip": True})
        labels = ax.get_axis_labels(x_label="x", y_label="y")
        self.play(Create(ax))
        self.play(Write(labels))
        self.wait(2)

Preview:#

Back to top