Adding Date to Dashboard
This commit is contained in:
@@ -662,7 +662,7 @@ print("\nFirst few rows:")
|
|||||||
print(df.head())
|
print(df.head())
|
||||||
|
|
||||||
# Hardcode specific patient names
|
# Hardcode specific patient names
|
||||||
patient_names = ['6ccda8c6']
|
patient_names = ['bc55b1b2']
|
||||||
|
|
||||||
# Define the functional systems (columns to plot) - adjust based on actual column names
|
# Define the functional systems (columns to plot) - adjust based on actual column names
|
||||||
functional_systems = ['EDSS', 'Visual', 'Sensory', 'Motor', 'Brainstem', 'Cerebellar', 'Autonomic', 'Bladder', 'Intellectual']
|
functional_systems = ['EDSS', 'Visual', 'Sensory', 'Motor', 'Brainstem', 'Cerebellar', 'Autonomic', 'Bladder', 'Intellectual']
|
||||||
@@ -672,7 +672,7 @@ num_plots = len(functional_systems)
|
|||||||
num_cols = 2
|
num_cols = 2
|
||||||
num_rows = (num_plots + num_cols - 1) // num_cols # Ceiling division
|
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:
|
if num_plots == 1:
|
||||||
axes = [axes]
|
axes = [axes]
|
||||||
elif num_rows == 1:
|
elif num_rows == 1:
|
||||||
@@ -733,6 +733,15 @@ for i in range(len(functional_systems)):
|
|||||||
if i >= len(axes) - num_cols: # Last row
|
if i >= len(axes) - num_cols: # Last row
|
||||||
axes[i].set_xlabel('Date')
|
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.tight_layout()
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user