Indonesia Salary by region from 1997-2022 – Visually by running a bar chart

Indonesia Salary by Region a running bar graph

How do I create a running bar chart using Google Colab?

Even though there are many ways to create a similar visualization. I would like to present to you how I did it using a google collab.

If you are not familiar with Google Colab. If you have ever used a word document on the cloud or google docs, Google Colab is a word document for coding using Jupyter Notebook Software.

Now let’s begin to recreate the exact visualization with the code I used.

Steps to Recreate this Graph in an easy way

Step 1: Get the Data and understand it

The data used in this visualization is from Kaggle. Following is the original dataset link from Kaggle

Link: https://www.kaggle.com/code/miteshmauriya/salary-per-person-in-indonasia

If you explore the data dictionary, it contains the following

  1. Year
  2. Region Name
  3. Salary Value
  4. Grand Total

Step2: Cleaned Data for you to use

I have done some magic and created ready-to-use data for your visualization. Here is the file for you to download

Download the file and unzip the CSV file.

Step 3: Open Google Colab and run the following code step by step

#installation of the required library
!pip install bar_chart_race
#importing the required libraries 
import pandas as pd
import bar_chart_race as bcr

Upload the CSV file to Google Colab Storage from the downloaded place

# Read the file into pandas dataframe

df= pd.read_csv('Indonesia_salary_region.csv')
df= df.set_index('Year')

#Check the file 
df.head()

Here comes the magic code for you!!!

bcr.bar_chart_race(df=df, filename=None, orientation ='h',
            sort='desc',
            n_bars=10,fixed_order=False,
            fixed_max=True,
            steps_per_period = 1,
            interpolate_period=False,period_label={'x': 0.99,'y':.25,'ha':'right','va':'center'},
            
            period_summary_func = lambda v,r :{ 'x':.99, 'y':.18, 's': f'Mean Salary: {v.nlargest(10).sum():,.0f}',
                                                'ha':'right', 'size':8, 'family':'Courier New'},
            perpendicular_bar_func='mean',
            label_bars=True,
            bar_size = 0.95,
            period_length=800,
            figsize=(8,3),
            dpi=144,
            cmap='dark12',
            title ='Indonesia Salary by Region from Year 1997 to 2022')

Note: Sometimes, when you copy the code indentation can be missed. Adjust the spacing to make it work

Here is what the output looks like

Further experimentation

Now, you might have similar questions like me

  • How can we do similarly to any other dataset?
  • Can I download the video?
  • Is it possible to customize the bar chart colors?
  • Is it possible to reduce the speed of the running bar chart ?

Here is the resource link that will help you answer the questions

Link: https://pypi.org/project/bar-chart-race/

Wish you a happy learning. Feel free to connect with me on LinkedIn and ask questions.

Leave a comment

Hello !!! I’m Ram Rallabandi

an AI consultant and data scientist with a proven track record of delivering high-impact AI solutions. My mission is simple: transform complex AI strategies into measurable business outcomes.

→ What I Do:
I specialize in leading the end-to-end lifecycle of AI products, from ideation to technical development to successful market launch. My expertise lies in bridging the gap between technical innovation and business value to ensure that every AI initiative aligns with organizational goals.

→ How I Add Value:
☑ Drive the adoption of responsible AI practices to future-proof businesses
☑ Build scalable, high-quality AI solutions that directly address customer needs
☑ Streamline processes to connect AI demand with delivery teams efficiently
☑ Analyze market trends to position data-driven solutions for maximum impact

Why It Works:
With a strong foundation in AI, machine learning, and data science, I provide strategic insights that empower organizations to leverage cutting-edge technologies for growth. I collaborate with technical and business teams to:
↳ Define product roadmaps
↳ Manage budgets, timelines, and scopes
↳ Foster cross-functional alignment for AI-driven innovation

My Passion:
I thrive on leading AI storytelling for executive leadership and fostering collaboration across diverse teams. With deep experience in Fintech and Payments, I’m dedicated to unlocking AI’s potential to deliver business transformation and create widely adopted solutions.

Let’s connect to explore how AI can transform your business.