import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from matplotlib import figure
stock_data = pd.read_csv('D:\\yangyang\\spy\\nltksample\\008\\600000.csv',
names=['data', 'no', 'comname', 'openprice',
'closeprice', 'meanprice'], encoding='gbk', nrows=100)
print(stock_data)
stockdata_new = pd.DataFrame(stock_data, columns=["data", "no", "comname"
, "openprice", "closeprice", "meanprice"])
print(stockdata_new)
plt.figure()
plt.scatter(stock_data['data'], stock_data['openprice'])
plt.xlabel('data') # added the name of the x axis
plt.ylabel('openprice') # add label to y-axis
plt.title('title') # add the title to your graph
plt.savefig("matplot1.jpg") # savefig
matplotlib 的数据可视化示例代码
最新推荐文章于 2024-04-17 02:26:07 发布