登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 lixiliang2008 于 2021-1-30 16:18 编辑
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from matplotlib import colors
import pandas as pd
cmap = colors.ListedColormap(['blue', 'deepskyblue','cyan','lightcyan','gold','salmon'])
bounds=[0,1,2,3,4,17,30]
norm = colors.BoundaryNorm(bounds, cmap.N)
data = pd.read_excel("F:/t.xlsx",header=None)
data.index = [16,17,18,19,20,21,22,23,24,25,26]
data.columns = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]
sns_plot=sns.heatmap(data, cmap=cmap, norm=norm, linecolor='k', linewidths = 0.1, annot=True, cbar=False)
u = pd.read_excel("F:/u.xlsx",header=None)
v = pd.read_excel("F:/v.xlsx",header=None)
x = np.array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])
y = np.array([1,2,3,4,5,6,7,8,9,10,11])
x, y =np.meshgrid(x, y)
plt.quiver(x + 0.5, y - 0.5, u, v, scale = 40, headwidth = 2, width = 0.003)
plt.rcParams['font.sans-serif']=['SimHei']#设置中文字体
plt.rcParams['axes.unicode_minus'] = False#设置识别
plt.title('tt',fontsize=20) #设置标题
plt.xlabel('Hour',fontsize=15)#设置x,y轴的标签
plt.ylabel('Date(Feb)',fontsize=15)
plt.xticks(fontsize=15)
plt.yticks(fontsize=15,rotation=360)
sns_plot.tick_params(labelsize=15, direction='in')
cb=sns_plot.figure.colorbar(sns_plot.collections[0]) #显示colorbar
cb.ax.tick_params(labelsize=14) #设置colorbar刻度字体大小。
plt.show()
|