当前位置:网站首页>Commodity price visualization

Commodity price visualization

2022-07-06 05:58:00 Twenty four bridges_

import numpy as np
import matplotlib.pyplot as plt

plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False

with open('rb2010.csv', 'r', encoding='utf-8') as f:
    file = f.readlines()[1:]
    date = [i.strip().split(',')[0] for i in file]
    settle = [int(i.strip().split(',')[5]) for i in file]

plt.grid(axis='both', color='k', linestyle='--', linewidth=1)
plt.xticks([i for i in range(len(date)) if i % 10 == 0], [i[-4:] for i in date[::10]], rotation=-30)
plt.yticks(np.arange(3200, 3801, 100))
plt.xlabel('2020 March to August ')
plt.ylabel(' Price ( element )')
plt.title(' Rebar futures trend chart ')
plt.plot(date, settle, linestyle='-', color='red', linewidth=1)
plt.savefig('rb2010p3.png')
plt.show()

原网站

版权声明
本文为[Twenty four bridges_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202132033222043.html