{% extends "base.html" %} {% block title %}Visualization Gallery - Data Science Lab{% endblock %} {% block content %}
Good visualizations tell stories. In Data-driven governance, charts and dashboards inform policy decisions on housing, transport, and urban planning.
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()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.