Skip to content

bingqiao/bar_chart_race_blender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

GDP Bar Chart Race with Blender

This project creates a bar chart race animation of the Gross Domestic Product (GDP) of the world's ten largest economies from 1975 to 2025. The animation is generated using Blender and a Python script.

Demo

GDP Bar Chart Race Animation

Features

  • Customizable: Easily configure the animation parameters, such as file paths, frame rates, colors, and layout, through a single CONFIG dictionary in the Python script.
  • Dynamic Labels: The country and GDP labels animate along with the bars.
  • Timeline: A timeline with a playhead indicates the current year of the animation.
  • Grid Lines: Dynamic grid lines adjust to the data for better readability.
  • Eevee Next Optimized: The script is optimized for Blender's Eevee Next render engine.

How to Use

  1. Open Blender: Launch Blender (version 3.0 or newer is recommended).
  2. Go to the Scripting Workspace: Switch to the "Scripting" workspace using the tab at the top of the screen.
  3. Open the Script: In the Text Editor view, click the "Open" button in the header (it looks like a folder icon). Navigate to this project's directory and select the gdp_bar_race.py file.
  4. Run the Script: Click the "Run Script" button (the play icon) in the Text Editor's header. This will execute the script, clearing the default scene and generating all the elements for the bar chart race.
  5. Render the Animation: To generate the final video, go to the main menu at the top-left of the Blender window and select Render > Render Animation. The video will be saved to the file path specified in the script's CONFIG section (by default, it will be named gdp_data_1975_2025.mp4 and saved in the same folder as the script).

Data Source

The GDP data is stored in gdp_data_1975_2025.csv. This file contains the GDP data for the following ten countries from 1975 to 2025:

  • USA
  • China
  • France
  • UK
  • Russia
  • Japan
  • Germany
  • India
  • Italy
  • Canada

The GDP values are in billions of US dollars. The script displays them in trillions.

Configuration

The gdp_bar_race.py script includes a CONFIG dictionary that allows you to easily customize the animation. Here are some of the key settings:

  • csv_path: Path to the GDP data file.
  • output_path: Path to save the rendered animation.
  • fps: Frames per second for the animation.
  • frames_per_year: Number of frames to represent one year.
  • start_year and end_year: The range of years to animate.
  • country_colors: A dictionary to set the color for each country's bar.
  • font_sizes: A dictionary to control the size of the various text elements.
  • layout: A dictionary to control the spacing and positioning of the chart elements.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Python script creating a Bar Chart Race in Blender 4.5

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages