From 7f771583b3346462b4fa9c5edf05860438475c21 Mon Sep 17 00:00:00 2001 From: Vincenzo Date: Sat, 26 Oct 2024 19:27:30 +0200 Subject: [PATCH] removed stacking from drawdown plot --- src/plot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plot.py b/src/plot.py index a267b05..6782426 100644 --- a/src/plot.py +++ b/src/plot.py @@ -113,7 +113,7 @@ def plot_correlation_map( def plot_returns( df: pd.DataFrame, annotation_text: str = "", min_resolution: float = 0.005 -) -> go.Figure(): +) -> go.Figure: n_bins = int(np.ceil((abs(df.max() - df.min()).div(min_resolution)).max())) fig = px.histogram(df, barmode="overlay", nbins=n_bins) @@ -144,7 +144,9 @@ def plot_returns( def plot_drawdown(df: pd.DataFrame) -> go.Figure: fig = px.area(data_frame=df) - fig.update_traces(hovertemplate="%{x}: %{y:.1%}") + fig.update_traces( + hovertemplate="%{x}: %{y:.1%}", stackgroup=None, fill="tozeroy" + ) fig.update_layout( autosize=False, height=600,