How to create live animation graphs in python using matplotlib

Alex G.
1 min readNov 9, 2020
(Photo,GIF by Author) https://github.com/oleksandr-g-rock/create_animation_graphs_in_python/blob/main/0_s47Ja_tCRYz4_FY-.gif

For this we need modules:

import pandas as pd
import matplotlib.pyplot as plt

So before using this guide please install these modules to your environment.
If you already install these modules, let's start.

At first please download this repo:

git clone https://github.com/oleksandr-g-rock/create_animation_graphs_in_python.git && cd How_to_create_animation_graphs_in_python

And run the next python script:

python3 show_graphs.py

You should see an animation graph from an old data

You can add new data to your DATA file: data_for_show.txt and you can see animation graphs with new data — in live time.
So open a new terminal and run this command — this command just add a new line to the end file.

cd How_to_create_animation_graphs_in_python && echo "10,3900" >> data_for_show.txt

Result:

You can see live animation like on this GIF

(Photo,GIF by Author) https://github.com/oleksandr-g-rock/create_animation_graphs_in_python/blob/main/0_s47Ja_tCRYz4_FY-.gif

Just for your information:
Full code & examples & notebook in my repository here.

--

--

Alex G.

ML DevOps engineer. 🙂 I am always open to new opportunities and offers. 🖖 I trying to help the world 🌏 with machine learning.