Adding Date to Dashboard

This commit is contained in:
2026-01-20 13:46:53 +01:00
parent c145b66cdf
commit 3834341ae9

View File

@@ -662,7 +662,7 @@ print("\nFirst few rows:")
print(df.head())
# Hardcode specific patient names
patient_names = ['6ccda8c6']
patient_names = ['bc55b1b2']
# Define the functional systems (columns to plot) - adjust based on actual column names
functional_systems = ['EDSS', 'Visual', 'Sensory', 'Motor', 'Brainstem', 'Cerebellar', 'Autonomic', 'Bladder', 'Intellectual']
@@ -672,7 +672,7 @@ num_plots = len(functional_systems)
num_cols = 2
num_rows = (num_plots + num_cols - 1) // num_cols # Ceiling division
fig, axes = plt.subplots(num_rows, num_cols, figsize=(15, 4*num_rows), sharex=True)
fig, axes = plt.subplots(num_rows, num_cols, figsize=(15, 4*num_rows), sharex=False) # Changed sharex=False
if num_plots == 1:
axes = [axes]
elif num_rows == 1:
@@ -733,6 +733,15 @@ for i in range(len(functional_systems)):
if i >= len(axes) - num_cols: # Last row
axes[i].set_xlabel('Date')
# Force date formatting on all axes
for ax in axes:
ax.tick_params(axis='x', rotation=45)
ax.xaxis.set_major_formatter(plt.matplotlib.dates.DateFormatter('%Y-%m-%d'))
ax.xaxis.set_major_locator(plt.matplotlib.dates.MonthLocator())
# Automatically format x-axis dates
plt.gcf().autofmt_xdate()
plt.tight_layout()
plt.show()