The Story of Peace and Conflict

Author: Sushobhan Parajuli
Date: December 08, 2023

This visualization provides insights into global conflicts and peace dynamics. The motivation behind this project stemmed from the ongoing wars in Russia-Ukraine and Israel-Palestine. The dataset utilized for this visualization is the Global Peace Index, where a lower score signifies peace, and a higher score indicates a heightened degree of conflict and violence

Despite the October escalation occurring post-data publication, both Israel and Palestine are depicted as high-conflict regions. This indicates that they were not peaceful places even before this escalation. Moreover, the primary goal of the visualization is to depict peace and conflict worldwide, extending beyond these specific regions.

Data Sources:

  1. Global Peace Index 2023 (Kaggle)
  2. Country Mapping (Kaggle)

In the second dataset, certain country names were spelled differently (e.g., Turkey vs. Tyrkiye, United States vs. United States of America), and Palestine was missing. To address these discrepancies, I edited the second dataset before importing it into this visualization project.

Data Visualization:

I utilized the Sunburst chart from Plotly Express in Python for this visualization. The Sunburst chart enhances our understanding by illustrating which regions and sub-regions of the world are currently undergoing conflicts. Prior to creating the visualization, I merged the two datasets based on country names.

# Import libraries
from google.colab import files
import pandas as pd
import plotly.express as px

# Upload the CSV files
uploaded_gpi = files.upload()
file_name_gpi = list(uploaded_gpi.keys())[0]
gpi = pd.read_csv(file_name_gpi)
gpi.head()

uploaded_geo = files.upload()
file_name_geo = list(uploaded_geo.keys())[0]
geo = pd.read_csv(file_name_geo)
geo.head()
# Merge two datasets
merged_df = pd.merge(gpi, geo, left_on='Country', right_on='name', how='inner')
# Add a column 'World'
merged_df['World'] = 'World'

# Display the merged DataFrame
merged_df.head()
# Filter data for the year 2023
data_2023 = merged_df[merged_df['year'] == 2023]

# Pass data to figure
fig = px.sunburst(data_frame=data_2023,
                  path=['World', 'region', 'sub-region', 'Country'],
                  values='Overall Scores',
                  color='Overall Scores',
                  color_continuous_scale='RdBu_r',
                  width=1000,
                  height=1000,
                  template='seaborn',
                  labels={'Overall Scores':'GPI Scores<br>in 2023'},
                  title='<b>The Story of Peace and Conflict'
                  )

# Define a function to format hovertemplate
def custom_hovertemplate(row):
    if row['Country']:
        return '<b>%{label}</b><br>Score: %{color:.3f}'
    else:
        return None

# Apply hovertemplate
fig.update_traces(hovertemplate=data_2023.apply(custom_hovertemplate, axis=1).tolist())

# Place the color scale legend at the bottom horizontally
fig.update_layout(coloraxis_colorbar=dict(
    x=-0.06,
    y=-0.06,
    xanchor='left',
    yanchor='top',
    orientation='h'
))

fig.show()

Studying Sunburst Chart:

A Sunburst chart starts at the center and extends outward along the branches, with more information found on the outer branches. Clicking a branch reveals a new plot where the region takes center stage. In the chart above, clicking on a region or sub-region displays a detailed view that is part of the main chart.

Global Peace Index (GPI) Scores:

In the sunburst chart, the GPI score refers to overall scores in the Global Peace Index dataset. A lower GPI score indicates that a nation is peaceful, while a higher score indicates that the nation is experiencing conflict. For example, Iceland, with a GPI score of 1.124, is the most peaceful country, while Afghanistan, with a GPI score of 3.448, is the least peaceful country. Russia and Ukraine, which have been engaged in conflict in recent years, also have higher scores, 3.142 and 3.043 respectively, indicating that they remain high-conflict areas in 2023.

Conclusion:

The visualization in this project utilizes two datasets: one containing global peace index data and the other geographical data. The chart illustrates regions, subregions, and countries experiencing conflicts and peace in 2023. This visualization plays a crucial role in informing the global scenario and emphasizing the significance of peace.