From abd89682951a60c6babc4670691991f49d621341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20E=2E=20Vald=C3=A9s-Tresanco?= <46581661+marioernestovaldes@users.noreply.github.com> Date: Wed, 18 Jun 2025 15:06:46 -0600 Subject: [PATCH] [dynamicviz] cap alpha heuristic --- dynamicviz/viz.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dynamicviz/viz.py b/dynamicviz/viz.py index c341716..5980619 100644 --- a/dynamicviz/viz.py +++ b/dynamicviz/viz.py @@ -416,9 +416,10 @@ def stacked( if vmax is None: vmax = np.max(df[label]) - # automatically set alpha based on heuristic - if alpha is None: - alpha = 0.2 / (df.shape[0] / 1000) + # automatically set alpha based on heuristic and cap at 1.0 for small datasets + if alpha is None: + alpha = 0.2 / (df.shape[0] / 1000) + alpha = min(alpha, 1.0) fig = plt.figure(figsize=(width, height))