Skip to content

Commit 91b7216

Browse files
committed
chore: update EfficientFrontier.plot_cml
1 parent 5ff2c34 commit 91b7216

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

okama/frontier/multi_period.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,8 +1411,11 @@ def plot_cml(self, rf_return: float = 0, figsize: Optional[tuple] = None):
14111411
mean_return_monthly = self.assets_ror.mean()
14121412
risks = helpers.Float.annualize_risk(risk_monthly, mean_return_monthly)
14131413
max_return = self.global_max_return_portfolio["CAGR"]
1414-
ax.set_ylim(0, max_return * 1.1) # height is 10% more than max portfolio CAGR
1415-
ax.set_xlim(0, max(risks) * 1.1) # width is 10% more than max risk
1414+
min_cagr = self.get_cagr().min()
1415+
y_bottom = min(min_cagr, rf_return)
1416+
plot_margin = 0.10
1417+
ax.set_ylim(y_bottom * (1 - plot_margin), max_return * (1 + plot_margin))
1418+
ax.set_xlim(0, max(risks) * (1 + plot_margin))
14161419
# plot the assets
14171420
self.plot_assets(kind="cagr")
14181421
return ax

0 commit comments

Comments
 (0)