Python Matplotlib(一)——绘图区域设置
来源:互联网 发布:称重收银软件免费 编辑:程序博客网 时间:2024/05/14 09:32
Figure对象全局参数设置
from matplotlib import rcParams# rcParams['axes.edgecolor']='white'# rcParams['xtick.color']='black'# rcParams['ytick.color']='black'# rcParams['axes.labelcolor']='black'# rcParams['text.color']='black'# rcParams['figure.edgecolor']=(1, 1, 1, 1)rcParams['figure.facecolor']=(1, 1, 1, 1)rcParams['font.family']='simhei'rcParams['font.size']=13#获取全部带font字样的参数名及valuelist=[(param, value) for param, value in plt.rcParams.items() if 'font' in param]
子区域绘图
subplots方法
#返回Figure对象、子区域对象组成的list对象fig,axes=plt.subplots(2,1,figsize=(10,8))#在各个子区域绘图:ax=axes[i]letter_prop['M'].plot(kind='bar',rot=0,ax=axes[0],title='Male')letter_prop['F'].plot(kind='bar',rot=0,ax=axes[1],title='Female',legend=False)
调整subplots子区域之间的间距
fig.tight_layout()
自动排版subplots_adjust
精确设置间距
plt.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)<br>left = 0.125 # the left side of the subplots of the figureright = 0.9 # the right side of the subplots of the figurebottom = 0.1 # the bottom of the subplots of the figuretop = 0.9 # the top of the subplots of the figurewspace = 0.2 # the amount of width reserved for blank space between subplotshspace = 0.2 # the amount of height reserved for white space between subplots
设置坐标轴范围
#方法1plt.axis([x_start,x_end,y_start,y_end])#方法2table.plot(yticks=np.linspace(0.4,1.2,9),xticks=range(1880,2020,10),figsize=(10,8)) #xticks需要传入一个list#range函数xticks=range(1880,2020,10) #step=10,不包含2020xticks=range(1880,2021,10) #需要2020时→2020+1
阅读全文
0 0
- Python Matplotlib(一)——绘图区域设置
- Python的matplotlib—绘图(3)
- python绘图——matplotlib,seaborn,plotly
- Python绘图——matplotlib绘图库入门
- Python绘图——Matplotlib 库绘图的安装步骤
- python matplotlib绘图设置坐标轴刻度、文本
- python绘图:matplotlib绘图(2)
- Python绘图教程——Matplotlib文档(详细版)后半部分
- Python数据分析与展示(4)——Matplotlib基础绘图函数示例
- python:matplotlib及pandas绘图(1)
- python:matplotlib及pandas绘图(2)
- 绘图: Python matplotlib简介
- python使用matplotlib绘图
- python matplotlib包 绘图
- Python:使用Matplotlib绘图
- Python中Matplotlib绘图
- python使用matplotlib绘图
- python-matplotlib绘图
- 降薪求职,看的是未来
- FR算法
- 算法作业23
- angular ng-change $event undefined
- listview的row的背景色设置
- Python Matplotlib(一)——绘图区域设置
- ubuntu 操作
- python基础知识
- 【dp每一天】HDU
- 一起学JAVA之《spring boot》04
- 经典Mybati面试题
- DDD实施经验分享—价值导向、从上往下进行(圈内第一个吃螃蟹DDD实施方案)
- sql
- 网络<二>httpclient /httpURLConnection