我已重命名dataframe A的索引,并将其绘制为热图:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
A = pd.DataFrame(np.array([[1,2,3,4],[5,6,7,8]]))
columns = np.array([ 0. , 0.635, 1.27 , 1.905])
rows = np.array([ 0. , 0.635])
A.columns = columns
A.index = rows
plt.imshow(A)
绘图的x轴显示0、1、2、3处的数据帧值,y轴显示0、1处的数据帧值
如何将轴的值更改为数据帧的值
希望x轴上的值位于0、0.635、1.27、1.905,y轴上的值位于0、0.635
在我看来,Seaborn比matplotlib.pyplot更适合制作热图
如果您想使用seabobrn
相关问题 更多 >
编程相关推荐