import matplotlib.pyplot as plt
import numpy as np
# 创建示例数据
data = np.random.rand(10, 10)
# 绘制图像并添加颜色条
fig, ax = plt.subplots()
im = ax.imshow(data, cmap='viridis')
cbar = fig.colorbar(im, orientation='vertical', label='Data Values', ticks=[])
# 添加箭头指示方向
arrowprops = dict(facecolor='black', arrowstyle='<-')
ax.annotate('', xy=(1.22, 0.3), xytext=(1.22, 0.7),
xycoords='axes fraction', textcoords='axes fraction',
arrowprops=arrowprops)
# 显示图像
plt.show()
Colorbar右侧添加箭头指向(如何去掉colorbar刻度)
最新推荐文章于 2024-07-04 16:04:39 发布