Fix issue #419 to display assets names in efficient frontier plot

This commit is contained in:
Dimitris Papakyriakopoulos
2022-05-09 20:15:10 +03:00
parent 4fecb3542c
commit f8e26db21e
2 changed files with 6 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -202,6 +202,12 @@ def _plot_ef(ef, ef_param, ef_param_range, ax, show_assets):
color="k", color="k",
label="assets", label="assets",
) )
"""
The following code puts the label from every ticker in EfficientFrontier object
in the right asset in the plot.
"""
for i, label in enumerate(ef.tickers):
ax.annotate(label, ( np.sqrt(np.diag(ef.cov_matrix))[i], ef.expected_returns[i]))
return ax return ax