Travel Tips
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
热图 - heatmap()
df = pd.DataFrame(np.random.rand(10,12)) # 创建数据 - 10*12图表 sns.heatmap(df, # 加载数据 vmin=0, vmax=1 # 设置图例最大最小值 )
# 参数设置 flights = sns.load_dataset("flights") flights = flights.pivot("month", "year", "passengers") print(flights.head()) # 加载数据 sns.heatmap(flights, annot = True, # 是否显示数值 fmt = 'd', # 格式化字符串 linewidths = 0.2, # 格子边线宽度 #center = 100, # 调色盘的色彩中心值,若没有指定,则以cmap为主 #cmap = 'Reds', # 设置调色盘 cbar = True, # 是否显示图例色带 #cbar_kws={"orientation": "horizontal"}, # 是否横向显示图例色带 #square = True, # 是否正方形显示图表 )
# 绘制半边热图 sns.set(style="white") # 设置风格 rs = np.random.RandomState(33) d = pd.DataFrame(rs.normal(size=(100, 26))) corr = d.corr() # 求解相关性矩阵表格 # 创建数据 mask = np.zeros_like(corr, dtype=np.bool) mask[np.triu_indices_from(mask)] = True # 设置一个“上三角形”蒙版 cmap = sns.diverging_palette(220, 10, as_cmap=True) # 设置调色盘 sns.heatmap(corr, mask=mask, cmap=cmap, vmax=.3, center=0, square=True, linewidths=0.2) # 生成半边热图
Sed ac lorem felis. Ut in odio lorem. Quisque magna dui, maximus ut commodo sed, vestibulum ac nibh. Aenean a tortor in sem tempus auctor
December 4, 2020 at 3:12 pm
Sed ac lorem felis. Ut in odio lorem. Quisque magna dui, maximus ut commodo sed, vestibulum ac nibh. Aenean a tortor in sem tempus auctor
December 4, 2020 at 3:12 pm
Donec in ullamcorper quam. Aenean vel nibh eu magna gravida fermentum. Praesent eget nisi pulvinar, sollicitudin eros vitae, tristique odio.
December 4, 2020 at 3:12 pm
我是 s enim interduante quis metus. Duis porta ornare nulla ut bibendum
Rosie
6 minutes ago