Syntrex's picture
Rename visualization/batter.txt to visualization/batter.py
266f4c7 verified
raw
history blame
789 Bytes
from __future__ import annotations
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
def create_exit_velocity_chart(df: pd.DataFrame) -> go.Figure:
if df.empty or "launch_speed" not in df.columns:
return go.Figure()
fig = px.histogram(
df,
x="launch_speed",
nbins=30,
title="Exit Velocity Distribution",
)
fig.update_layout(template="plotly_dark")
return fig
def create_launch_angle_chart(df: pd.DataFrame) -> go.Figure:
if df.empty or "launch_angle" not in df.columns:
return go.Figure()
fig = px.histogram(
df,
x="launch_angle",
nbins=30,
title="Launch Angle Distribution",
)
fig.update_layout(template="plotly_dark")
return fig