summaryrefslogtreecommitdiff
path: root/finance/visualize.py
blob: 66943c71b749fff4e7bb3b4c56fba6a10505e1c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from datetime import datetime
from decimal import Decimal

import matplotlib.pyplot


def display(
    simulated: list[tuple[datetime, Decimal]],
    measured: list[tuple[datetime, Decimal]],
) -> None:
    matplotlib.pyplot.plot(
        [i[0] for i in simulated],  # type: ignore
        [float(i[1]) for i in simulated],
        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()