标签:Oday 概念 inf 外观 rda image pre 关系 技术
概念>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
散点图显示两组数据的值,每个点的坐标位置由变量的值决定。
由一组不连接的点完成,用于观察两种变量的相关性。
例如身高-体重、温度-纬度、等等。
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
import numpy as np import matplotlib.pyplot as plt height = [161,170,182,175,173,165] weight = [50,58,80,70,69,55] plt.scatter(height,weight) plt.show()
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
股票前后两天的涨跌关系
import numpy as np import matplotlib.pyplot as plt open,close = np.loadtxt("000001.csv",delimiter=",",skiprows=1,usecols=(1,4),unpack= True) change = close - open yesterday = change[:-1] today = change[1:] plt.scatter(yesterday,today) plt.show()
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
图的外观
颜色, c
点大小, s
透明度, alpha
点形状, marker
plt.scatter(yesterday,today,s = 100,c = "r",marker="<",alpha=0.5)
作业
使用000001.SH数据。
计算最高价和开盘价之差diff。
绘出前后两天diff的散点图,研究是否有相关性。
import numpy as np import matplotlib.pyplot as plt open,high = np.loadtxt("000001.csv",delimiter=",",skiprows=1,usecols=(1,2),unpack= True) diff = high - open yesterday = diff[:-1] today = diff[1:] # plt.scatter(yesterday,today) # plt.show() plt.scatter(yesterday,today,s = 400,c= ‘y‘,marker="2",alpha= 0.3) plt.show()
标签:Oday 概念 inf 外观 rda image pre 关系 技术
原文地址:https://www.cnblogs.com/dushuhubian/p/10293720.html