def plot(returns,
title="Monthly Returns (%)\n",
title_color="black",
title_size=14,
annot_size=10,
figsize=None,
cmap='RdYlGn',
cbar=True,
square=False,
is_prices=False,
eoy=False):
returns = get(returns, eoy=eoy, is_prices=is_prices)
returns *= 100
if figsize is None:
size = list(plt.gcf().get_size_inches())
figsize = (size[0], size[0] // 2)
plt.close()
fig, ax = plt.subplots(figsize=figsize)
ax = sns.heatmap(returns, ax=ax, annot=True, center=0,
annot_kws={"size": annot_size},
fmt="0.2f", linewidths=0.5,
square=square, cbar=cbar, cmap=cmap)
ax.set_title(title, fontsize=title_size,
color=title_color, fontweight="bold")
fig.subplots_adjust(hspace=0)
plt.yticks(rotation=0)
plt.show()
plt.close()
评论列表
文章目录