From 3834341ae9611efa99ceb5393e7714fa306a1d40 Mon Sep 17 00:00:00 2001 From: Shahin Ramezanzadeh Date: Tue, 20 Jan 2026 13:46:53 +0100 Subject: [PATCH] Adding Date to Dashboard --- Data/show_plots.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Data/show_plots.py b/Data/show_plots.py index 7804ddb..8c137b3 100644 --- a/Data/show_plots.py +++ b/Data/show_plots.py @@ -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()