This repository has been archived on 2025-02-02. You can view files and clone it, but cannot push or open issues or pull requests.
Files_for_MM/simple-plot.py
2025-01-25 17:34:14 +08:00

23 lines
500 B
Python

import json
import numpy as np
import matplotlib.pyplot as plt
colorList = json.load(open('color/config.json','r'))["color"]
import csv
with open('data/passenger.csv', 'r') as f:
reader = csv.reader(f)
header = next(reader)
data = [row for row in reader]
data = np.array(data).astype(int).T
bar_width = 0.25
for i in range(1,len(data)):
plt.bar(data[0]+(i-2)*bar_width, data[i], label=header[i], color=colorList[i-1], width=bar_width)
plt.legend()
plt.xlabel('Year')
plt.show()