-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscatterplot.py
More file actions
27 lines (23 loc) · 757 Bytes
/
scatterplot.py
File metadata and controls
27 lines (23 loc) · 757 Bytes
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
"""Scatter plot visualization for earthquake magnitude vs depth."""
import plotly.express as px
def build_scatterplot(data, color_var):
"""Build a scatter plot of magnitude vs depth.
Args:
data: DataFrame containing earthquake data with 'magnitude' and 'depth'
color_var: Variable to use for coloring points ('none', 'magType', 'net')
Returns:
Plotly figure object
"""
color = None if color_var == "none" else color_var
fig = px.scatter(
data,
x="magnitude",
y="depth",
color=color,
opacity=0.7,
labels={"magnitude": "Magnitude", "depth": "Depth (km)"},
)
fig.update_layout(
margin={"l": 40, "r": 20, "t": 20, "b": 40},
)
return fig