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)