Skip to content

Commit 5455d36

Browse files
committed
feat: add **kwargs to plot_assets for matplotlib scatter()
1 parent 3a3d83a commit 5455d36

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

okama/common/make_asset_list.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -613,11 +613,12 @@ def currency(self) -> str:
613613
return self._currency.currency
614614

615615
def plot_assets(
616-
self,
617-
kind: str = "mean",
618-
tickers: Union[str, list] = "tickers",
619-
pct_values: bool = False,
620-
xy_text: tuple = (0, 10),
616+
self,
617+
kind: str = "mean",
618+
tickers: Union[str, list] = "tickers",
619+
pct_values: bool = False,
620+
xy_text: tuple = (0, 10),
621+
**kwargs
621622
) -> Axes:
622623
"""
623624
Plot asset points on the risk-return chart with annotations.
@@ -645,6 +646,9 @@ def plot_assets(
645646
xy_text : tuple, default (0, 10)
646647
The shift of the annotation text (x, y) from the point.
647648
649+
**kwargs
650+
Arbitrary keyword arguments passed to matplotlib.pyplot.scatter.
651+
648652
Returns
649653
-------
650654
Axes
@@ -685,7 +689,7 @@ def plot_assets(
685689
plt.autoscale(enable=True, axis="year", tight=False)
686690
ax.margins(0.05, 0.1) # increase margins on Y-axis from 5% to 10% as `annotate` moves text upwards
687691
m = 100 if pct_values else 1
688-
ax.scatter(risks * m, returns * m, zorder=10)
692+
ax.scatter(risks * m, returns * m, zorder=10, **(kwargs or {}))
689693
# Set the labels
690694
if tickers == "tickers":
691695
asset_labels = self.symbols

0 commit comments

Comments
 (0)