Welcome to an immersive journey through the dynamic world of video game sales! In this visual exploration, we delve deep into the intricate web of gaming trends, charting the rise and fall of iconic titles, genres, and platforms. Join us as we unravel the stories behind the numbers, uncovering the pulse of the gaming industry and the driving forces shaping its evolution. Through captivating visuals and insightful analysis, prepare to embark on an adventure that transcends mere data, painting a vivid portrait of the ever-changing landscape of video game sales.
The data set comprises information on over 16,500 video games, each with sales exceeding 100,000 copies. The data was collected through web scraping from vgchartz.com. It includes various attributes such as the game’s ranking based on overall sales, title, platform of release (e.g., PC, PS4), release year, genre, publisher, and sales figures across different regions, including North America, Europe, Japan, and other parts of the world.
The data set offers insights into the global sales performance of each game, combining sales data from different regions. The data set provides a rich resource for analyzing trends in the video game industry, understanding the popularity of different genres and platforms, and exploring the impact of publishers on sales success. With its comprehensive coverage and detailed sales data, this data set is invaluable for researchers, analysts, and enthusiasts interested in the dynamics of the video game market.
Data set: https://www.kaggle.com/datasets/gregorut/videogamesales
In this analysis, we aim to explore video game sales data from 1980 to 2020, focusing on key industry aspects. We’ll identify regions with the highest sales, uncover popular genres, examine platform distribution, highlight top-selling games, and assess the contributions of publishers. By doing so, we aim to gain insights into the video game industry’s trends and evolution over the past four decades.
The multiple line plot illustrates video game sales across various regions, with North America emerging as the primary market. Interestingly, we observe a peak in sales between 2005 and 2010, followed by a gradual decline. This decline could potentially be attributed to factors such as rising sales prices, shifting consumer preferences, or changes in gaming technology. By analyzing these trends, we can better understand the dynamics of the video game industry and anticipate future developments.
import wget
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.ticker
URL ="https://www.kaggle.com/datasets/gregorut/videogamesales/download?datasetVersionNumber=2"
path="C:\\Users\\Cristina Rosette\\OneDrive\\Documents\\Data Visualization\\Python Project CJ\\"
path="C:\\Users\\Cristina Rosette\\OneDrive\\Documents\\Data Visualization\\Python Project CJ\\"
filename= path + "vgsales.csv"
df= pd.read_csv(filename, nrows=5)
#Multiple line plots for regional video game sales over the years
df2=pd.read_csv(filename, usecols=['Year','NA_Sales','EU_Sales', 'JP_Sales', 'Other_Sales', 'Global_Sales'])
#Preparing data
#Grouping the sales data by year and summing up sales for each region
sales_df = df2.groupby('Year').agg({
'NA_Sales': 'sum',
'EU_Sales': 'sum',
'JP_Sales': 'sum',
'Other_Sales': 'sum',
'Global_Sales': 'sum'
}).reset_index()
sales_df.columns= ['Year', 'North America', 'Europe', 'Japan', 'Other Countries', 'Global'] #renaming columns
#Line plot code
fig=plt.figure(figsize=(18,10))
ax=fig.add_subplot(1,1,1)
#Plotting each line for each sale
for region in ['North America', 'Europe', 'Japan', 'Other Countries', 'Global']:
sales_df.plot(ax=ax, kind='line', x='Year', y=region, label=region, marker=8)
#Adding labels and title
plt.title('Video Game Sales by Region Over the Years(1980-2020)', fontsize=20)
plt.xlabel('Year', fontsize=14)
plt.ylabel('Sales (in Millions)', fontsize=14)
plt.show()
From 1980 to 2020, Action has consistently been the dominant genre in the video game industry, followed closely by Sports. These genres feature a diverse range of challenges, including combat, puzzle-solving, and reflex-based activities like jumping and chasing. Action games often offer immersive storytelling and multiplayer options, making them appealing to a wide audience. Their intuitive gameplay and gradually increasing difficulty over time contribute to their enduring popularity among gamers.
#Bar plot
df=pd.read_csv(filename, usecols=['Genre'])
#Preparing data for bar plot
x= df.groupby(['Genre']).agg({'Genre':['count']}).reset_index() #sorting genres by count
x.columns= ['Genre', 'Count']
x= x.sort_values('Count', ascending=False)
x.reset_index(inplace=True, drop=True)
#Bar plot
plt.figure(figsize=(18,10))
genre_bar=plt.bar(x.loc[0:11, "Genre"], x.loc[0:11, "Count"], color='lightgreen')
for bar in genre_bar:
height = bar.get_height()
plt.text(bar.get_x() + bar.get_width() / 2, height, height, ha='center', va='bottom', fontsize=13)
plt.xlabel('Genre', fontsize=14)
plt.ylabel('Count', fontsize=14)
plt.title('Top Video Game Genres (1980-2020)', fontsize=20)
plt.show()
The leading platforms from 1980 to 2020 include the Nintendo DS and Sony Playstation 2, as expected. Throughout the history of the video game industry, Nintendo and Sony have maintained significant dominance, a trend reinforced by recent successes such as the Nintendo Switch and PS5. The enduring popularity of these platforms highlights the substantial market presence and ongoing innovation demonstrated by Nintendo and Sony in the gaming landscape.
#Donut chart
df3=pd.read_csv(filename, usecols=['Name', 'Platform'])
#Peparing data
df = pd.DataFrame(df3)
# Count the number of top-selling games for each platform
platform_counts = df['Platform'].value_counts().head(10)
fig = plt.figure(figsize=(15,9))
ax = fig.add_subplot(1, 1, 1)
# Grouping the data by platform and summing up the counts
platform_counts.plot(
kind='pie', radius=1, pctdistance=0.5, labeldistance=1.1,
wedgeprops=dict(edgecolor='w'), textprops={'fontsize': 12},
autopct='%1.1f%%', startangle=140, ax=ax
)
# Setting title
plt.title('Top 10 Platform Distribution of Top-Selling Games (1980-2020)', fontsize=18)
plt.show()
This visualization highlights the influence of top genres and platforms on the list of top 10 games of all time. Action-packed titles like Call of Duty and GTA dominate the market, alongside classic Nintendo character Mario games.
#Heatmap for top 10 games per year
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
df4=pd.read_csv(filename, usecols=['Name', 'Year','Global_Sales'])
df = pd.DataFrame(df4)
# Preparing the data for heatmap
top_10_games = df.groupby('Name')['Global_Sales'].sum().nlargest(10).index
#Filter the DataFrame for top 10 games
top_10_games_df = df[df['Name'].isin(top_10_games)]
#Removing NA
top_10_games_df = top_10_games_df[np.isfinite(top_10_games_df['Year'])]
#Convert 'Year' column to integers
top_10_games_df['Year'] = top_10_games_df['Year'].astype(int)
#Pivotting data table
heatmap_data = top_10_games_df.pivot_table(index='Name', columns='Year', values='Global_Sales', aggfunc='sum')
# Plotting the heatmap
plt.figure(figsize=(18,10))
comma_fmt= FuncFormatter (lambda x, p:format(int(x), ','))
heatmap = sns.heatmap(heatmap_data, linewidth=0.2, cmap='coolwarm', annot=True, fmt=".1f",
square=True, annot_kws={'size': 11},
cbar_kws={'format': comma_fmt, 'orientation': 'vertical'})
plt.title('Top 10 Games Throughout All Years', fontsize=18, pad=15)
plt.xlabel('Year', fontsize=18, labelpad=10)
plt.ylabel('Game', fontsize=18, labelpad=10)
plt.xticks(size=14, rotation=45)
plt.tight_layout()
#Add label to color bar
cbar = heatmap.collections[0].colorbar
cbar.set_label('Global Sale (in Millions)', rotation=270, size=14, labelpad=20)
plt.show()
Once more, Nintendo emerges as a dominant force in the industry, maintaining its influence for decades. However, in recent years, we observe the rise of Activision, the developer behind Call of Duty, and Electronic Arts (EA), renowned for its sports games like NBA and FIFA.
#Stacked bar chart
from matplotlib import cm
df5=pd.read_csv(filename, usecols=['Name','Year', 'Publisher', 'Global_Sales'])
df = pd.DataFrame(df5)
#Preparing the data
#Top 5 publishers per year
top_publishers_per_year = df.groupby(['Year', 'Publisher']).size().reset_index(name='Count')
top_publishers_per_year = top_publishers_per_year.sort_values(by=['Year', 'Count'], ascending=[True, False])
top_publishers_per_year = top_publishers_per_year.groupby('Year').head(5)
#Merging the top publishers with the original DataFrame to filter the data
df_filtered = pd.merge(df, top_publishers_per_year, on=['Year', 'Publisher'])
# Filter years to display every 5 years, filtered out 2020 because it contained no data
years_to_display = list(range(1980, 2019, 5))
#Stacked bar chart
yearly_publisher_sales = df_filtered.groupby(['Year', 'Publisher'])['Global_Sales'].sum().unstack().fillna(0)
num_publishers = len(yearly_publisher_sales.columns)
colors = cm.tab20(np.linspace(0, 1, num_publishers)) # Get a colormap with enough colors for all publishers
plt.figure(figsize=(18,10))
ax = plt.subplot(1, 1, 1)
yearly_publisher_sales.loc[years_to_display].plot(kind='bar', stacked=True, color=colors, ax=ax)
plt.title('Top Sales by Top 5 Publishers Every 5 Years (1980-2015)', fontsize=18, loc='center', pad=10)
plt.xlabel('Year', fontsize=12, labelpad=10)
plt.ylabel('Global Sales (in Millions)', fontsize=12)
#legend position and size
plt.legend(title='Publisher', fontsize=12, bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0., title_fontsize='12')
plt.tight_layout()
plt.show()
Analyzing video game sales is key for developers and publishers to understand what gamers want and where the industry is headed. By crunching sales data, companies can spot hot trends, tweak their games, and invest resources wisely. This helps them create titles that players love and that sell big. Plus, keeping an eye on sales trends lets them stay nimble in a fast-changing market, adjusting strategies to stay ahead of the competition. In the end, diving into sales figures isn’t just about making money—it’s about keeping the gaming world fresh, profitable, and full of surprises.