Add simple matplotlib graph

This commit is contained in:
flyingscorpio@arch-desktop 2020-05-06 11:47:31 +02:00
parent 172920b594
commit 5ec1b1ca14

View file

@ -12,6 +12,8 @@ from pathlib import Path
import subprocess
from typing import Any, Dict, List
import matplotlib.pyplot as plt # type: ignore
def grab_json_with_curl() -> str:
"""Run the curl command in a shell and grab the output as json."""
@ -65,14 +67,14 @@ def print_to_output(confirmed: int, today_confirmed_int: int,
"""Format the data for the i3block."""
if today_confirmed_int >= 0:
today_confirmed = f"+{today_confirmed_int}"
today_confirmed = f"{today_confirmed_int}"
else:
today_confirmed = f"{today_confirmed_int}"
today_confirmed = f"{today_confirmed_int}"
if today_deaths_int >= 0:
today_deaths = f"+{today_deaths_int}"
today_deaths = f"{today_deaths_int}"
else:
today_deaths = f"{today_deaths_int}"
today_deaths = f"{today_deaths_int}"
output = f"{confirmed} ({today_confirmed}) ✝ {deaths} ({today_deaths})"
@ -82,7 +84,11 @@ def print_to_output(confirmed: int, today_confirmed_int: int,
def generate_graph(data: List[int]) -> None:
"""Generate a small graph based on the evolution of numbers in the list."""
print("HELLO THERE")
print(data[0:20])
data = [number // 1000 for number in data]
X = range(len(data))
plt.plot(X, [data[i] for i in X])
plt.show()
def main() -> None: