matplotlib画图(3)
2014-06-13 00:00
369 查看
import matplotlib.pyplot as plt import matplotlib.patches as patches # build a rectangle in axes coords left, width = .25, .5 bottom, height = .25, .5 right = left + width top = bottom + height fig = plt.figure() ax = fig.add_axes([0,0,1,1]) # axes coordinates are 0,0 is bottom left and 1,1 is upper right p = patches.Rectangle( (left, bottom), width, height, fill=False, transform=ax.transAxes, clip_on=False ) ax.add_patch(p) ax.text(left, bottom, 'left top', horizontalalignment='left', verticalalignment='top', transform=ax.transAxes) ax.text(left, bottom, 'left bottom', horizontalalignment='left', verticalalignment='bottom', transform=ax.transAxes) ax.text(right, top, 'right bottom', horizontalalignment='right', verticalalignment='bottom', transform=ax.transAxes) ax.text(right, top, 'right top', horizontalalignment='right', verticalalignment='top', transform=ax.transAxes) ax.text(right, bottom, 'center top', horizontalalignment='center', verticalalignment='top', transform=ax.transAxes) ax.text(left, 0.5*(bottom+top), 'right center', horizontalalignment='right', verticalalignment='center', rotation='vertical', transform=ax.transAxes) ax.text(left, 0.5*(bottom+top), 'left center', horizontalalignment='left', verticalalignment='center', rotation='vertical', transform=ax.transAxes) ax.text(0.5*(left+right), 0.5*(bottom+top), 'middle', horizontalalignment='center', verticalalignment='center', fontsize=20, color='red', transform=ax.transAxes) ax.text(right, 0.5*(bottom+top), 'centered', horizontalalignment='center', verticalalignment='center', rotation='vertical', transform=ax.transAxes) ax.text(left, top, 'rotated\nwith newlines', horizontalalignment='center', verticalalignment='center', rotation=45, transform=ax.transAxes) ax.set_axis_off() plt.show()
相关文章推荐
- python画图包seaborn和matplotlib中文字体显示(针对windows系统,,使用ipython notebook)
- ubuntu下matplotlib画图中文乱码问题
- Python画图工具matplotlib的安装
- matplotlib画图时的中文设置
- 【Python】Matplotlib画图(五)——多图片共框
- python中matplotlib和pandas画图
- 用 python matplotlib 画图 简单记录
- matplotlib画图(5)
- Python画图工具matplotlib的使用(图形并茂)
- matplotlib画图
- matplotlib.pyplot 画图相关
- 【转】matplotlib画图时的中文设置
- 读书笔记5基于matplotlib画图
- matplotlib 画图 散列图
- matplotlib画图基础,华氏温度到摄氏温度的转换
- Python matplotlib 画图窗口显示到gui或者控制台的实例
- matplotlib画图一些属性
- python matplotlib 画图
- python画图包matplotlib
- Python使用matplotlib和pandas实现的画图操作【经典示例】