Skip to content

Commit

Permalink
BUG Monthly returns distribution should not stack by year.
Browse files Browse the repository at this point in the history
  • Loading branch information
twiecki committed Oct 7, 2015
1 parent 3c45d9e commit 2e8cbea
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pyfolio/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,22 +285,21 @@ def plot_monthly_returns_dist(returns, ax=None, **kwargs):
ax.tick_params(axis='x', which='major', labelsize=10)

monthly_ret_table = timeseries.aggregate_returns(returns, 'monthly')
monthly_ret_table = monthly_ret_table.unstack()
monthly_ret_table = np.round(monthly_ret_table, 3)

ax.hist(
100 * monthly_ret_table.dropna().values.flatten(),
100 * monthly_ret_table,
color='orangered',
alpha=0.80,
bins=20,
**kwargs)

ax.axvline(
100 *
monthly_ret_table.dropna().values.flatten().mean(),
100 * monthly_ret_table.mean(),
color='gold',
linestyle='--',
lw=4,
alpha=1.0)

ax.axvline(0.0, color='black', linestyle='-', lw=3, alpha=0.75)
ax.legend(['mean'])
ax.set_ylabel('Number of months')
Expand Down

0 comments on commit 2e8cbea

Please sign in to comment.