From 21a196957d77a1ff4d8ca91a7869fd877861b7c0 Mon Sep 17 00:00:00 2001 From: Taewan Date: Sun, 4 Aug 2024 23:49:50 +0900 Subject: [PATCH] Remove 0.0 when there is no trade, sams as monthly_heatmap_detailedview --- quantstats_lumi/_plotting/wrappers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/quantstats_lumi/_plotting/wrappers.py b/quantstats_lumi/_plotting/wrappers.py index 1866ed6..158eee2 100644 --- a/quantstats_lumi/_plotting/wrappers.py +++ b/quantstats_lumi/_plotting/wrappers.py @@ -935,6 +935,7 @@ def monthly_heatmap( cmap = "gray" if grayscale else "RdYlGn" returns = _stats.monthly_returns(returns, eoy=eoy, compounded=compounded) * 100 + mask = returns.map(lambda x: x == 0) fig_height = len(returns) / 2.5 @@ -983,6 +984,7 @@ def monthly_heatmap( cbar=cbar, cmap=cmap, cbar_kws={"format": "%.0f%%"}, + mask=mask, ) else: ax.set_title( @@ -1005,6 +1007,7 @@ def monthly_heatmap( cbar=cbar, cmap=cmap, cbar_kws={"format": "%.0f%%"}, + mask=mask, ) # _sns.set(font_scale=1) @@ -1017,6 +1020,8 @@ def monthly_heatmap( _plt.xticks(rotation=0, fontsize=annot_size * 1.2) _plt.yticks(rotation=0, fontsize=annot_size * 1.2) + plt.grid(False) + try: _plt.subplots_adjust(hspace=0, bottom=0, top=1) except Exception: