From 712716ab0cdebbec9fabb25eea3bf40e4354749d Mon Sep 17 00:00:00 2001 From: Thomas Wiecki Date: Mon, 15 Apr 2019 12:51:06 +0200 Subject: [PATCH] BUG Get axis instead of figure. --- pyfolio/plotting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfolio/plotting.py b/pyfolio/plotting.py index db26b1d8..dda07161 100644 --- a/pyfolio/plotting.py +++ b/pyfolio/plotting.py @@ -1213,7 +1213,7 @@ def plot_max_median_position_concentration(positions, ax=None, **kwargs): """ if ax is None: - ax = plt.gcf() + ax = plt.gca() alloc_summary = pos.get_max_median_position_concentration(positions) colors = ['mediumblue', 'steelblue', 'tomato', 'firebrick'] @@ -1249,7 +1249,7 @@ def plot_sector_allocations(returns, sector_alloc, ax=None, **kwargs): """ if ax is None: - ax = plt.gcf() + ax = plt.gca() sector_alloc.plot(title='Sector allocation over time', alpha=0.5, ax=ax, **kwargs)