color theme
This commit is contained in:
23
plots.py
23
plots.py
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import plotly.graph_objects as go
|
import plotly.graph_objects as go
|
||||||
import polars as pl
|
import polars as pl
|
||||||
|
from theme import ColorPalette
|
||||||
|
|
||||||
|
|
||||||
def plot_average_scores_with_counts(
|
def plot_average_scores_with_counts(
|
||||||
@@ -9,7 +10,7 @@ def plot_average_scores_with_counts(
|
|||||||
title: str = "General Impression (1-10)<br>Per Voice with Number of Participants Who Rated It",
|
title: str = "General Impression (1-10)<br>Per Voice with Number of Participants Who Rated It",
|
||||||
x_label: str = "Stimuli",
|
x_label: str = "Stimuli",
|
||||||
y_label: str = "Average General Impression Rating (1-10)",
|
y_label: str = "Average General Impression Rating (1-10)",
|
||||||
color: str = "#0077B6",
|
color: str = ColorPalette.PRIMARY,
|
||||||
height: int = 500,
|
height: int = 500,
|
||||||
width: int = 1000,
|
width: int = 1000,
|
||||||
) -> go.Figure:
|
) -> go.Figure:
|
||||||
@@ -74,16 +75,16 @@ def plot_average_scores_with_counts(
|
|||||||
yaxis_title=y_label,
|
yaxis_title=y_label,
|
||||||
height=height,
|
height=height,
|
||||||
width=width,
|
width=width,
|
||||||
plot_bgcolor='white',
|
plot_bgcolor=ColorPalette.BACKGROUND,
|
||||||
xaxis=dict(
|
xaxis=dict(
|
||||||
showgrid=True,
|
showgrid=True,
|
||||||
gridcolor='lightgray',
|
gridcolor=ColorPalette.GRID,
|
||||||
tickangle=-45
|
tickangle=-45
|
||||||
),
|
),
|
||||||
yaxis=dict(
|
yaxis=dict(
|
||||||
range=[0, 10],
|
range=[0, 10],
|
||||||
showgrid=True,
|
showgrid=True,
|
||||||
gridcolor='lightgray'
|
gridcolor=ColorPalette.GRID
|
||||||
),
|
),
|
||||||
font=dict(size=11)
|
font=dict(size=11)
|
||||||
)
|
)
|
||||||
@@ -96,7 +97,7 @@ def plot_top3_ranking_distribution(
|
|||||||
title: str = "Top 3 Rankings Distribution<br>Count of 1st, 2nd, and 3rd Place Votes per Voice",
|
title: str = "Top 3 Rankings Distribution<br>Count of 1st, 2nd, and 3rd Place Votes per Voice",
|
||||||
x_label: str = "Voices",
|
x_label: str = "Voices",
|
||||||
y_label: str = "Number of Mentions in Top 3",
|
y_label: str = "Number of Mentions in Top 3",
|
||||||
height: int = 600,
|
height: int = 500,
|
||||||
width: int = 1000,
|
width: int = 1000,
|
||||||
) -> go.Figure:
|
) -> go.Figure:
|
||||||
"""
|
"""
|
||||||
@@ -161,7 +162,7 @@ def plot_top3_ranking_distribution(
|
|||||||
name='Rank 1 (1st Choice)',
|
name='Rank 1 (1st Choice)',
|
||||||
x=labels,
|
x=labels,
|
||||||
y=stats_df['Rank 1'],
|
y=stats_df['Rank 1'],
|
||||||
marker_color='#004C6D', # Dark Blue
|
marker_color=ColorPalette.RANK_1,
|
||||||
hovertemplate='<b>%{x}</b><br>Rank 1: %{y}<extra></extra>'
|
hovertemplate='<b>%{x}</b><br>Rank 1: %{y}<extra></extra>'
|
||||||
))
|
))
|
||||||
|
|
||||||
@@ -169,7 +170,7 @@ def plot_top3_ranking_distribution(
|
|||||||
name='Rank 2 (2nd Choice)',
|
name='Rank 2 (2nd Choice)',
|
||||||
x=labels,
|
x=labels,
|
||||||
y=stats_df['Rank 2'],
|
y=stats_df['Rank 2'],
|
||||||
marker_color='#008493', # Teal
|
marker_color=ColorPalette.RANK_2,
|
||||||
hovertemplate='<b>%{x}</b><br>Rank 2: %{y}<extra></extra>'
|
hovertemplate='<b>%{x}</b><br>Rank 2: %{y}<extra></extra>'
|
||||||
))
|
))
|
||||||
|
|
||||||
@@ -177,7 +178,7 @@ def plot_top3_ranking_distribution(
|
|||||||
name='Rank 3 (3rd Choice)',
|
name='Rank 3 (3rd Choice)',
|
||||||
x=labels,
|
x=labels,
|
||||||
y=stats_df['Rank 3'],
|
y=stats_df['Rank 3'],
|
||||||
marker_color='#5AAE95', # Sea Green
|
marker_color=ColorPalette.RANK_3,
|
||||||
hovertemplate='<b>%{x}</b><br>Rank 3: %{y}<extra></extra>'
|
hovertemplate='<b>%{x}</b><br>Rank 3: %{y}<extra></extra>'
|
||||||
))
|
))
|
||||||
|
|
||||||
@@ -188,15 +189,15 @@ def plot_top3_ranking_distribution(
|
|||||||
yaxis_title=y_label,
|
yaxis_title=y_label,
|
||||||
height=height,
|
height=height,
|
||||||
width=width,
|
width=width,
|
||||||
plot_bgcolor='white',
|
plot_bgcolor=ColorPalette.BACKGROUND,
|
||||||
xaxis=dict(
|
xaxis=dict(
|
||||||
showgrid=True,
|
showgrid=True,
|
||||||
gridcolor='lightgray',
|
gridcolor=ColorPalette.GRID,
|
||||||
tickangle=-45
|
tickangle=-45
|
||||||
),
|
),
|
||||||
yaxis=dict(
|
yaxis=dict(
|
||||||
showgrid=True,
|
showgrid=True,
|
||||||
gridcolor='lightgray'
|
gridcolor=ColorPalette.GRID
|
||||||
),
|
),
|
||||||
legend=dict(
|
legend=dict(
|
||||||
orientation="h",
|
orientation="h",
|
||||||
|
|||||||
21
theme.py
Normal file
21
theme.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
"""
|
||||||
|
Color palette and style definitions for Voice Branding analysis plots.
|
||||||
|
"""
|
||||||
|
|
||||||
|
class ColorPalette:
|
||||||
|
"""
|
||||||
|
Consistent color palette for all visualizations.
|
||||||
|
Update colors here to propagate changes to all plots.
|
||||||
|
"""
|
||||||
|
# Primary brand/chart color
|
||||||
|
PRIMARY = "#0077B6" # Medium Blue
|
||||||
|
|
||||||
|
# Gradient for rankings (Darkest -> Lightest or Strong -> Soft)
|
||||||
|
RANK_1 = "#004C6D" # Dark Blue (1st Choice)
|
||||||
|
RANK_2 = "#008493" # Teal (2nd Choice)
|
||||||
|
RANK_3 = "#5AAE95" # Sea Green (3rd Choice)
|
||||||
|
|
||||||
|
# General UI elements
|
||||||
|
TEXT = "black"
|
||||||
|
GRID = "lightgray"
|
||||||
|
BACKGROUND = "white"
|
||||||
Reference in New Issue
Block a user