Spaces:
Sleeping
Sleeping
Rename visualization/batter.txt to visualization/batter.py
Browse files- visualization/batter.py +33 -0
- visualization/batter.txt +0 -0
visualization/batter.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import pandas as pd
|
| 4 |
+
import plotly.express as px
|
| 5 |
+
import plotly.graph_objects as go
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def create_exit_velocity_chart(df: pd.DataFrame) -> go.Figure:
|
| 9 |
+
if df.empty or "launch_speed" not in df.columns:
|
| 10 |
+
return go.Figure()
|
| 11 |
+
|
| 12 |
+
fig = px.histogram(
|
| 13 |
+
df,
|
| 14 |
+
x="launch_speed",
|
| 15 |
+
nbins=30,
|
| 16 |
+
title="Exit Velocity Distribution",
|
| 17 |
+
)
|
| 18 |
+
fig.update_layout(template="plotly_dark")
|
| 19 |
+
return fig
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def create_launch_angle_chart(df: pd.DataFrame) -> go.Figure:
|
| 23 |
+
if df.empty or "launch_angle" not in df.columns:
|
| 24 |
+
return go.Figure()
|
| 25 |
+
|
| 26 |
+
fig = px.histogram(
|
| 27 |
+
df,
|
| 28 |
+
x="launch_angle",
|
| 29 |
+
nbins=30,
|
| 30 |
+
title="Launch Angle Distribution",
|
| 31 |
+
)
|
| 32 |
+
fig.update_layout(template="plotly_dark")
|
| 33 |
+
return fig
|
visualization/batter.txt
DELETED
|
File without changes
|