Skip to content

Commit

Permalink
add sort by appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelsoup42 committed Oct 14, 2023
1 parent 37de479 commit ddd8a86
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def make_transaction_frame(
def _plot_title(self):
return f"Asset balances in wallet until block {self.data.to_block}."

def plot_balance(self, order:str="alpha"):
def plot_balance(self, order:str="appearance"):
""" Create a Matplotlib plot with the asset balance over time."""
balance = self.make_balance_frame(with_total=False,raw_values=True).cumsum()
if order=="alpha":
Expand All @@ -606,7 +606,13 @@ def plot_balance(self, order:str="alpha"):
key=lambda i: [self.asset_names.get(x, x) for x in i],
)
elif order=="appearance":
pass
balance.sort_index(
axis=1,
level=0,
sort_remaining=True,
inplace=True,
key=lambda i: [balance[x].first_valid_index() for x in i],
)
else:
raise ValueError(f"Unkown ordering: {order}")
fig,ax=pyplot.subplots(len(balance.columns),2,
Expand Down

0 comments on commit ddd8a86

Please sign in to comment.