Download templates/visualization.html from hengds2f/capstone: direct link, hf CLI and curl.
- Browser
- Download file 4.09 kB
-
https://huggingface.co/spaces/hengds2f/capstone/resolve/main/templates/visualization.html
- Command line
-
hf download hf://spaces/hengds2f/capstone/templates/visualization.html
-
curl -L -o visualization.html https://huggingface.co/spaces/hengds2f/capstone/resolve/main/templates/visualization.html
4.09 kB
| {% extends "base.html" %} | |
| {% block title %}Visualization Gallery - Data Science Lab{% endblock %} | |
| {% block content %} | |
| <div class="page-header"> | |
| <h1>π Visualization Gallery</h1> | |
| <p class="breadcrumb">Home / Visualization β Interactive charts from datasets</p> | |
| </div> | |
| <div class="concept-section"> | |
| <div class="concept-header"><h3>π Data Visualization Principles</h3></div> | |
| <div class="concept-body"> | |
| <p>Good visualizations tell stories. In Data-driven governance, charts and dashboards inform policy decisions on housing, transport, and urban planning.</p> | |
| <h4>Key Principles</h4> | |
| <ul> | |
| <li><strong>Choose the right chart type:</strong> Bar for comparison, line for trends, scatter for relationships, heatmap for correlations</li> | |
| <li><strong>Label clearly:</strong> Title, axis labels, legends, units</li> | |
| <li><strong>Avoid clutter:</strong> Remove unnecessary gridlines, decorations, and 3D effects</li> | |
| <li><strong>Use color purposefully:</strong> Consistent palette, colorblind-friendly, meaningful encoding</li> | |
| </ul> | |
| </div> | |
| </div> | |
| {% if charts.transport %} | |
| <div class="chart-container"> | |
| <h3 style="margin-bottom: 12px;">π Transit Station Usage</h3> | |
| <div id="chart-transport"></div> | |
| </div> | |
| {% endif %} | |
| {% if charts.population %} | |
| <div class="chart-container"> | |
| <h3 style="margin-bottom: 12px;">π₯ Population Distribution</h3> | |
| <div id="chart-population"></div> | |
| </div> | |
| {% endif %} | |
| {% if charts.energy %} | |
| <div class="chart-container"> | |
| <h3 style="margin-bottom: 12px;">β‘ Energy Consumption Trends</h3> | |
| <div id="chart-energy"></div> | |
| </div> | |
| {% endif %} | |
| {% if charts.schools %} | |
| <div class="chart-container"> | |
| <h3 style="margin-bottom: 12px;">π« School Enrollment</h3> | |
| <div id="chart-schools"></div> | |
| </div> | |
| {% endif %} | |
| {% if charts.hdb_bubble %} | |
| <div class="chart-container"> | |
| <h3 style="margin-bottom: 12px;">ποΈ Price vs Area (Bubble Chart)</h3> | |
| <div id="chart-hdb-bubble"></div> | |
| </div> | |
| {% endif %} | |
| <div class="card"> | |
| <div class="card-header"><h3>π₯ Download Data</h3></div> | |
| <div style="display: flex; gap: 12px; flex-wrap: wrap;"> | |
| <a href="/download/hdb" class="btn btn-primary">π Housing Data (CSV)</a> | |
| <a href="/download/transport" class="btn btn-primary">π Transport Data (CSV)</a> | |
| <a href="/download/population" class="btn btn-primary">π Population Data (CSV)</a> | |
| <a href="/download/energy" class="btn btn-primary">π Energy Data (CSV)</a> | |
| </div> | |
| </div> | |
| <div class="code-block"><span class="lang-label">Python</span><pre>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()</pre></div> | |
| <div class="exercise-box"> | |
| <h5>π§ͺ Try It Yourself</h5> | |
| <p>1. Create a box plot of resale prices by flat type.</p> | |
| <p>2. Make a line chart showing monthly average prices over time.</p> | |
| <p>3. Design a heatmap showing price per sqm by town and flat type.</p> | |
| </div> | |
| {% endblock %} | |
| {% block scripts %} | |
| <script> | |
| </script> | |
| {% endblock %} | |