Skip to content
0

Numeria Population Distribution

In this competition, take on the role of an aspiring data sorcerer and use the magical AI assistant to craft a more enchanting visualization that reveals the distribution of magical creatures across Numeria's kingdoms.

📖 Once upon a time...

Valuable data about mystical creatures inhabiting the kingdoms of Numeria was gathered in the enchanted land of Numeria. Dragons, unicorns, fairies, goblins, elves, and trolls lived in places like the Enchanted Forest, Mystic Mountains, and Whispering Woods.

However, the chart in the Great Hall failed to clearly show how these creatures were distributed. A cryptic visualization lost important insights...

🔍 Explore the magical dataset

Familiarize yourself with the magical data of Numeria. The dataset contains:

  • Kingdom: The name of the kingdom where the creatures reside
  • CreatureType: The type of mystical creature (e.g., Dragon, Unicorn)
  • Number_of_Creatures: The total number of that creature type in the kingdom
import pandas as pd
import matplotlib.pyplot as plt

# Load the dataset
data = pd.read_csv('magical_creatures_by_kingdom.csv')
display(data.head(10))
import pandas as pd
import matplotlib.pyplot as plt

# Load the dataset
data = pd.read_csv('magical_creatures_by_kingdom.csv')

# Aggregate the total number of creatures by kingdom
kingdom_totals = data.groupby('Kingdom')['Number_of_Creatures'].sum().reset_index()

# Plot the bar chart
plt.figure(figsize=(10, 6))
plt.bar(kingdom_totals['Kingdom'], kingdom_totals['Number_of_Creatures'], color='skyblue')

# Label the axes and add a title
plt.xlabel('Kingdom')
plt.ylabel('Total Number of Creatures')
plt.title('Total Number of Creatures by Kingdom')

# Show the plot
plt.xticks(rotation=45)  # Rotate x-axis labels for better readability
plt.show()
import pandas as pd
import matplotlib.pyplot as plt
import plotly.express as px

# Load the dataset
data = pd.read_csv('magical_creatures_by_kingdom.csv')

# Define a color mapping for creature types
color_mapping = {
    'Dragon': 'slateblue',
    'Unicorn': 'violet',
    'Goblin': 'lightcoral',
    'Fairy': 'sandybrown',
    'Troll': 'springgreen',
    'Elf' : 'cyan'
}

# Pivot the data to create a table with Kingdoms as rows and CreatureTypes as columns
pivot_data = data.pivot(index='Kingdom', columns='CreatureType', values='Number_of_Creatures')

# Plot the bar chart using matplotlib
colors = [color_mapping.get(creature, 'grey') for creature in pivot_data.columns]  # Get colors for each creature type
pivot_data.plot(kind='bar', figsize=(10, 6), color=colors)

# Label the axes and add a title
plt.xlabel('Kingdom')
plt.ylabel('Number of Creatures')
plt.title('Number of Each Creature in Each Kingdom')

# Show the legend
plt.legend(title='Creature Type', labels=pivot_data.columns)

# Show the plot
plt.show()


# Create the interactive bar chart using plotly
fig = px.bar(data, 
             x='Kingdom', 
             y='Number_of_Creatures', 
             color='CreatureType', 
             color_discrete_map=color_mapping,  # Use the same color mapping
             barmode='group',  # Group bars by CreatureType within each Kingdom
             title='Number of Each Creature in Each Kingdom',
             labels={'Number_of_Creatures': 'Number of Creatures'})

# Update layout for better axis titles
fig.update_layout(
    xaxis_title='Kingdom',
    yaxis_title='Number of Creatures',
    legend_title='Creature Type'
)

# Show the interactive plot
fig.show()


Narrative Around the Charts

The three charts illuminate the enchanting world of magical creatures in the kingdoms of Numeria, each serving a unique purpose in conveying data and storytelling.

The first chart presents the total number of creatures in each kingdom, revealing that the Enchanted Forest is the most populated realm. This vibrant kingdom thrives with a plethora of mystical beings, suggesting a rich ecosystem. In contrast, the Shimmering Shores appears as the least populated kingdom, implying a tranquil environment with fewer magical inhabitants. This information invites curiosity about the ecological factors influencing creature populations across the kingdoms.

Initially, this data was represented in a line chart, which obscured the important categorical differences among the kingdoms. Line charts are typically used to display trends over time, making them unsuitable for comparing static populations of creatures across distinct categories. Transitioning to bar charts effectively clarifies the visual narrative, allowing for quick comparisons between kingdoms.

The second chart dives deeper by detailing the number of each creature type in each kingdom. This static representation breaks down total populations into specific species, enriching the narrative and highlighting diversity within each kingdom.

The third chart enhances storytelling through interactivity. When users hover over data points, they can instantly view the exact number of creatures for each type, transforming a passive experience into an engaging exploration. This interactive feature makes the data more accessible and encourages users to delve deeper into the nuances of magical life in Numeria.

In conclusion, these three charts work in concert to transform raw data into a compelling story about the magical creatures of Numeria, highlighting their diversity and the unique characteristics of each kingdom.