From 2560d862d5019db1b103a6e6a9c14dfa66afe78d Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 8 Sep 2024 11:37:41 +0200 Subject: Move display() to finance.visualize.py --- finance/visualize.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 finance/visualize.py (limited to 'finance/visualize.py') diff --git a/finance/visualize.py b/finance/visualize.py new file mode 100644 index 0000000..e6d609a --- /dev/null +++ b/finance/visualize.py @@ -0,0 +1,16 @@ +from datetime import datetime +from decimal import Decimal + +import matplotlib.pyplot + + +def display(data: tuple[list[datetime], list[Decimal]]) -> None: + matplotlib.pyplot.plot( + list(data[0]), # type: ignore + [float(i) for i in data[1]], + label="Money", + ) + matplotlib.pyplot.xlabel("Time") + matplotlib.pyplot.legend() + matplotlib.pyplot.xticks(rotation=45) + matplotlib.pyplot.show() -- cgit v1.2.3-70-g09d2