Update functions/pitch_summary_functions.py
Browse files
functions/pitch_summary_functions.py
CHANGED
|
@@ -338,7 +338,7 @@ def tj_stuff_roling_game(df: pl.DataFrame, window: int, ax: plt.Axes):
|
|
| 338 |
])
|
| 339 |
|
| 340 |
sns.lineplot(x=range(1, max(df_item['start_number_right']) + 1),
|
| 341 |
-
y=df_item.filter(pl.col('pitch_type') == i)['tj_stuff_plus'].rolling_mean(window),
|
| 342 |
color=dict_colour[i],
|
| 343 |
ax=ax, linewidth=3)
|
| 344 |
|
|
@@ -346,14 +346,14 @@ def tj_stuff_roling_game(df: pl.DataFrame, window: int, ax: plt.Axes):
|
|
| 346 |
for n in range(len(df_item)):
|
| 347 |
if df_item['game_id'].is_null()[n]:
|
| 348 |
sns.scatterplot(x=[df_item['start_number_right'][n]],
|
| 349 |
-
y=[df_item['tj_stuff_plus'].rolling_mean(window)[n]],
|
| 350 |
color='white',
|
| 351 |
-
ec=
|
| 352 |
ax=ax,
|
| 353 |
zorder=100)
|
| 354 |
|
| 355 |
# Adjust x-axis limits to start from 1
|
| 356 |
-
ax.set_xlim(
|
| 357 |
ax.set_ylim(70, 130)
|
| 358 |
ax.set_xlabel('Games', fontdict=font_properties_axes)
|
| 359 |
ax.set_ylabel('tjStuff+', fontdict=font_properties_axes)
|
|
|
|
| 338 |
])
|
| 339 |
|
| 340 |
sns.lineplot(x=range(1, max(df_item['start_number_right']) + 1),
|
| 341 |
+
y=df_item.filter(pl.col('pitch_type') == i)['tj_stuff_plus'].rolling_mean(window,min_periods=1),
|
| 342 |
color=dict_colour[i],
|
| 343 |
ax=ax, linewidth=3)
|
| 344 |
|
|
|
|
| 346 |
for n in range(len(df_item)):
|
| 347 |
if df_item['game_id'].is_null()[n]:
|
| 348 |
sns.scatterplot(x=[df_item['start_number_right'][n]],
|
| 349 |
+
y=[df_item['tj_stuff_plus'].rolling_mean(window,min_periods=1)[n]],
|
| 350 |
color='white',
|
| 351 |
+
ec=dict_colour[i],
|
| 352 |
ax=ax,
|
| 353 |
zorder=100)
|
| 354 |
|
| 355 |
# Adjust x-axis limits to start from 1
|
| 356 |
+
ax.set_xlim(1, max(df_item['start_number']))
|
| 357 |
ax.set_ylim(70, 130)
|
| 358 |
ax.set_xlabel('Games', fontdict=font_properties_axes)
|
| 359 |
ax.set_ylabel('tjStuff+', fontdict=font_properties_axes)
|