From 24ca965e11f1e7af13c3d91e4c40f455eecf2df4 Mon Sep 17 00:00:00 2001 From: "houhan@gmail.com" Date: Tue, 14 Jan 2025 19:10:17 +0000 Subject: [PATCH] fix legend color --- code/pages/0_Data inventory.py | 8 ++++---- code/util/settings.py | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/code/pages/0_Data inventory.py b/code/pages/0_Data inventory.py index d18d4a1..7e6c660 100644 --- a/code/pages/0_Data inventory.py +++ b/code/pages/0_Data inventory.py @@ -299,18 +299,18 @@ def count_true_values(df, time_period, column): height=500, bargap=0.05, # Gap between bars of adjacent locations bargroupgap=0.1, # Gap between bars of the same location - barmode='group', # Grouped style + barmode="group", # Grouped style showlegend=True, + title="Monthly counts", legend=dict( orientation="h", # Horizontal legend y=-0.2, # Position below the plot x=0.5, # Center the legend xanchor="center", # Anchor the legend's x position - yanchor="top" # Anchor the legend's y position + yanchor="top", # Anchor the legend's y position ), - title="Monthly counts" ) - + return fig def app(): diff --git a/code/util/settings.py b/code/util/settings.py index cb27d7a..65d157a 100644 --- a/code/util/settings.py +++ b/code/util/settings.py @@ -39,6 +39,7 @@ # For plotly styling PLOTLY_FIG_DEFAULT = dict( font_family="Arial", + legend_font_color='black', ) PLOTLY_AXIS_DEFAULT = dict( showline=True, @@ -98,6 +99,7 @@ def override_plotly_theme( color="black" # Font color ) + # Figure-level settings fig.update_layout( font_size=22 * font_size_scale, hoverlabel_font_size=17 * font_size_scale,