# Create a beautiful graph with Manim

## We explain step by step how to create a graph, showing the interquartile range with Manim.

5 min readNov 28, 2021

# Prerequisites

In this tutorial, I use version 0.12.0 of Manim. I have no idea if it works with earlier or later versions. I assume you know the basic use of Manim. If you don’t, take a look at the many tutorials for beginners available.

The full code is available in the last section.

# Create axis

First thing to do is to create axis. For this, nothing could be simpler:

`from manim import * # I'll skip this line for the following`

class MyBeautifulGraph(Scene):

def construct(self):

axes = Axes()

self.add(axes)

Then, build the scene using

`manim your_file.py`

Here is the result.

# Create a line

Very simple, no comments needed here.

`class MyBeautifulGraph(Scene):`

def construct(self):

axes = Axes()

x = [0, 1, 2, 3, 4]

y = [1, 2, 4, 2, 3]

line = axes.plot_line_graph(x, y, add_vertex_dots=False)

self.add(axes, line)

# Create a shaded area

Here is the critical part. There is no function (to my knowledge) that allows you to create this shaded space with a line object. No problem! Here’s the trick:

`import numpy as np`

class MyBeautifulGraph(Scene):

def construct(self):

axes = Axes()

x = [0, 1, 2, 3, 4]

y = [1, 2, 4, 2, 3]

low_q = [-1, 0, 1, 1, 2]

high_q = [2, 3, 5, 4, 4]

line = axes.plot_line_graph(x, y, add_vertex_dots=False)…