Py.Cafe

Coding-with-Adam/

plotly-fire-incidents-visualization

Plotly Fire Incidents Visualization

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# check out https://dash.plotly.com/ for Dash documentation
# check out https://plotly.com/python for Plotly documentation
# check out Plotly High Level refernece docs: https://plotly.com/python-api-reference/plotly.express.html

from dash import Dash, Input, Output, callback, dcc, html
import pandas as pd
import plotly.express as px

# Best to grab the raw csv data link from GitHub
df = pd.read_csv('https://raw.githubusercontent.com/jragh/plotlymeetup/refs/heads/main/June_2025/Fire%20Incidents%20Data%20Raw.csv')

"""
Use this sectiont to slice, clean, filter data to prepare it for the figure
"""


# Build the figure
fig = px.scatter(df, x="Number_of_responding_personnel", 
y="Estimated_Dollar_Loss", log_x=True, log_y=True, )


app = Dash(__name__)
app.layout = html.Div(
    children=[
        # assign the fig to the 'figure' property to view
        dcc.Graph(figure=fig)
    ]
)