From 4e8d17c8d0b7d5406d3a9df8c320b5cbabb9d330 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 8 Sep 2024 12:36:43 +0200 Subject: Add measured values --- finance/visualize.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'finance/visualize.py') diff --git a/finance/visualize.py b/finance/visualize.py index e6d609a..c7a7c60 100644 --- a/finance/visualize.py +++ b/finance/visualize.py @@ -4,13 +4,24 @@ from decimal import Decimal import matplotlib.pyplot -def display(data: tuple[list[datetime], list[Decimal]]) -> None: +def display( + simulated: tuple[list[datetime], list[Decimal]], + measured: list[tuple[datetime, Decimal]], +) -> None: matplotlib.pyplot.plot( - list(data[0]), # type: ignore - [float(i) for i in data[1]], - label="Money", + list(simulated[0]), # type: ignore + [float(i) for i in simulated[1]], + label="Simulated", + ) + matplotlib.pyplot.plot( + [i[0] for i in measured], # type: ignore + [float(i[1]) for i in measured], + label="Measured", + marker="x", + linestyle="None", ) matplotlib.pyplot.xlabel("Time") + matplotlib.pyplot.ylabel("Money") matplotlib.pyplot.legend() matplotlib.pyplot.xticks(rotation=45) matplotlib.pyplot.show() -- cgit v1.2.3-70-g09d2