Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

LINE-CHART-RACE-ANIMATION-PYTHON

An animated line chart visualizing the temporal dynamics of Forest Formation (Formasi Hutan) and Oil Palm Plantation (Sawit) land cover areas in Aceh Tamiang Regency, Indonesia from 2000 to 2024. Built with Python, matplotlib.animation, and pandas.

Repositori di GitHub

Python Matplotlib License Platform

An animated line chart visualizing the temporal dynamics of Forest Formation (Formasi Hutan) and Oil Palm Plantation (Sawit) land cover areas in Aceh Tamiang Regency, Indonesia from 2000 to 2024. Built with Python, matplotlib.animation, and pandas.


Tambahkan subjudul

📌 Overview

This notebook produces a frame-by-frame animated line plot that progressively reveals land cover area changes across six temporal snapshots (2000, 2005, 2010, 2015, 2020, 2024). The animation is exported as a ile and also rendered interactively in Jupyter/Colab via to_jshtml().

The visualization is intended to support land change analysis in the context of tropical deforestation monitoring, particularly in areas experiencing oil palm encroachment into forested landscapes — a critical concern for mangrove and peatland carbon stock assessments in coastal Aceh.


📂 Repository Structure

├── Animasi_Plot_Race.ipynb          # Main notebook
├── README.md                        # Project documentation
└── Rangkaian waktu Wilayah • Wilayah berdasarkan kelas • 1990 - 2024.csv
                                     # Input land cover time-series data

📊 Data Source

FieldDescription
SourceLand cover time-series classification (MapBiomas / local derivative)
RegionAceh Tamiang Regency, Aceh Province, Indonesia
ClassesFormasi Hutan (Forest Formation), Sawit (Oil Palm Plantation)
Period1990–2024 (subset used: 2000–2024)
UnitHectares (Ha)
Column keyTingkat 2 = land cover class label

⚠️ The CSV file must be placed in the same working directory as the notebook before execution.


🔧 Requirements

Python Libraries

pip install pandas matplotlib pillow
LibraryVersion TestedPurpose
pandas≥ 1.3Data loading and reshaping
matplotlib≥ 3.4Plotting and animation

Runtime Environment


🚀 Usage

1. Clone the Repository

git clone https://github.com/<your-username>/<repo-name>.git
cd <repo-name>

2. Upload Data (if using Google Colab)

from google.colab import files
uploaded = files.upload()  # Upload the CSV file

3. Run the Notebook

Execute cells sequentially (Steps 1–10). The animation will:


🧱 Notebook Structure

StepCell Description
1Import libraries (pandas, matplotlib, animation)
2Load and filter CSV data for target land cover classes
3Define temporal snapshots (2000–2024)
4Reshape data: set year as index (X-axis)
5Assign class colors (#2ca02c for Forest, #9467bd for Oil Palm)
6Configure axes limits, ticks, labels, and title
7Initialize animated line objects with markers
8Add dynamic text labels at line endpoints
9Define update() function for frame-by-frame rendering
10Execute FuncAnimation, export GIF, and display HTML

⚙️ Key Parameters

# Temporal snapshots used in animation
years = ['2000', '2005', '2010', '2015', '2020', '2024']

# Animation settings
interval = 800      # Milliseconds between frames
fps      = 1.5      # Frames per second for GIF export

# Color scheme
colors = {
    'Formasi Hutan': '#2ca02c',   # Forest green
    'Sawit':         '#9467bd'    # Purple (oil palm)
}

📤 Output

FileDescription
grafik_garis_temporal.gifAnimated GIF of the temporal line chart
Notebook inline outputInteractive HTML animation via ani.to_jshtml()

⚠️ Known Issues & Notes


🌍 Scientific Context

This animation supports temporal land cover analysis relevant to:


Author

Name : Defani Arman Alfitriansyah Institution : Universitas Kuningan


📝 License

This project is licensed under the MIT License.

Notebook

Notebook dari repositori ini, tampil lengkap dengan sel kode dan hasilnya: