{% extends "base.html" %} {% block title %}Visualization Gallery - Data Science Lab{% endblock %} {% block content %}

๐Ÿ“– Data Visualization Principles

Good visualizations tell stories. In Data-driven governance, charts and dashboards inform policy decisions on housing, transport, and urban planning.

Key Principles

{% if charts.transport %}

๐Ÿš‡ Transit Station Usage

{% endif %} {% if charts.population %}

๐Ÿ‘ฅ Population Distribution

{% endif %} {% if charts.energy %}

โšก Energy Consumption Trends

{% endif %} {% if charts.schools %}

๐Ÿซ School Enrollment

{% endif %} {% if charts.hdb_bubble %}

๐Ÿ˜๏ธ Price vs Area (Bubble Chart)

{% endif %}

๐Ÿ“ฅ Download Data

๐Ÿ“„ Housing Data (CSV) ๐Ÿ“„ Transport Data (CSV) ๐Ÿ“„ Population Data (CSV) ๐Ÿ“„ Energy Data (CSV)
Python
import plotly.express as px
import pandas as pd

# Creating interactive charts with Plotly
df = pd.read_csv('data/housing_data.csv')

# Bar chart: Average price by town
fig = px.bar(
    df.groupby('town')['price'].mean().reset_index(),
    x='town', y='price',
    title='Average Housing Data Price by Town',
    labels={'price': 'Average Price (SGD)'}
)
fig.update_layout(xaxis_tickangle=-45)
fig.show()

# Scatter plot with trendline
fig2 = px.scatter(
    df, x='area', y='price',
    color='property_type', trendline='ols',
    title='Floor Area vs Price with Trendline'
)
fig2.show()
๐Ÿงช Try It Yourself

1. Create a box plot of resale prices by flat type.

2. Make a line chart showing monthly average prices over time.

3. Design a heatmap showing price per sqm by town and flat type.

{% endblock %} {% block scripts %} {% endblock %}