matplotlib改变colorbar位置和方向
2017-04-01 15:23
5860 查看
#! usr/bin/python #coding=utf-8 import numpy as np import matplotlib.pyplot as plt data=np.random.rand(10,10) fig, ax=plt.subplots() data[data==-1]=np.nan#去掉缺省值-1 im =ax.imshow(data,interpolation='none',cmap='Reds_r',vmin=0.6,vmax=.9)#不插值 #去掉边框 ax.spines['top'].set_visible(False) ax.spines['right'].set_visible(False) ax.spines['bottom'].set_visible(False) ax.spines['left'].set_visible(False) ######################################################################## position=fig.add_axes([0.15, 0.05, 0.7, 0.03])#位置[左,下,右,上] cb=plt.colorbar(im,cax=position,orientation='horizontal')#方向
相关文章推荐
- matplotlib 显示图片鼠标所指位置的坐标
- 使用matplotlib的示例:调整字体-设置colormap和colorbar
- matplotlib中legend位置调整解析
- 使用matplotlib的示例:调整字体-设置colormap和colorbar
- matplotlib中legend位置调整
- Matplotlib 中文用户指南 3.3 使用 GridSpec 自定义子图位置
- matplotlib.pyplot 标记出曲线上最大点和最小点的位置
- matplotlib中如何改变figure的布局和大小
- matplotlib获取鼠标所在位置的axes
- Python 使用matplotlib画图添加标注、及移动坐标轴位置
- matplotlib模块数据可视化-修改坐标轴位置
- matplotlib(刻度,刻度线长短位置相关设置)
- 使用matplotlib的示例:调整字体-设置刻度、坐标、colormap和colorbar等
- python中matplotlib的颜色及线条控制【以及改变legend字体大小】
- matplotlib 可视化 —— 移动坐标轴(中心位置)
- python matplotlib 任意位置和字符串 ticket 设置
- Python 使用matplotlib画图添加标注、及移动坐标轴位置
- 快捷改变matplotlib绘图中不能正常显示中文的问题
- matplotlib如何改变legend的字号
- matplotlib使用GridSpec调整子图位置大小 (非对称的子图)