数据可视化之 tick_params( 参数 )
参考:https://blog.csdn.net/helunqu2017/article/details/78736554/
初学数据可视化,遇到了tick_params() 里面传参数问题,找了一些资料,觉得这个简单明了,非常好用,推荐看下!
1.tick_params语法
Axes.tick_params(axis=’both’, **kwargs)
参数:
axis : {‘x’, ‘y’, ‘both’} Axis on which to operate; default is ‘both’. (axis:轴)
reset : bool If True, set all parameters to defaults before processing other keyword arguments. Default is False.
which : {‘major’, ‘minor’, ‘both’} Default is ‘major’; apply arguments to which ticks.
direction : {‘in’, ‘out’, ‘inout’} Puts ticks inside the axes, outside the axes, or both.
length : float Tick length in points.
width : float Tick width in points.
color : color Tick color; accepts any mpl color spec.
pad : float Distance in points between tick and label.
labelsize : float or str Tick label font size in points or as a string (e.g., ‘large’).
labelcolor : color Tick label color; mpl color spec.
colors : color Changes the tick color and the label color to the same value: mpl color spec.
zorder : float Tick and label zorder.
bottom, top, left, right : bool or {‘on’, ‘off’} controls whether to draw the respective ticks.
labelbottom, labeltop, labelleft, labelright : bool or {‘on’, ‘off’} controls whether to draw the respective tick labels.
labelrotation : float Tick label rotation
2.tick_params例子:
参数axis的值为’x’、’y’、’both’,分别代表设置X轴、Y轴以及同时设置,默认值为’both’。
ax1.tick_params(axis=’x’,width=2,colors=’gold’)
ax2.tick_params(axis=’y’,width=2,colors=’gold’)
ax3.tick_params(axis=’both’,width=2,colors=’gold’)
参数which的值为 ‘major’、’minor’、’both’,分别代表设置主刻度线、副刻度线以及同时设置,默认值为’major’ (主刻度线、副刻度线类似于厘米尺。CM与MM的区别)
ax1.tick_params(which=’major’,width=2,colors=’gold’)
ax2.tick_params(which=’minor’,width=2,colors=’gold’)
ax3.tick_params(which=’both’,width=2,colors=’gold’)
参数direction的值为’in’、’out’、’inout’,分别代表刻度线显示在绘图区内侧、外侧以及同时显示
ax1.tick_params(direction=’in’,width=2,length=4,colors=’gold’)
ax2.tick_params(direction=’out’,width=2,length=4,colors=’gold’)
ax3.tick_params(direction=’inout’,width=2,length=4,colors=’gold’)
length和width
参数length和width分别用于设置刻度线的长度和宽度
ax2.tick_params(width=4,colors=’gold’)
ax3.tick_params(length=10,colors=’gold’)
参数pad用于设置刻度线与标签间的距离
ax2.tick_params(pad=1,colors=’gold’)
ax3.tick_params(pad=10,colors=’gold’)
参数color、labelcolor、colors分别用于设置刻度线的颜色、刻度线标签的颜色以及同时设置刻度线及标签颜色
ax1.tick_params(width=4,color=’gold’)
ax2.tick_params(width=4,labelcolor=’gold’)
ax3.tick_params(width=4,colors=’gold’)
参数labelsize用于设置刻度线标签的字体大小
ax1.tick_params(labelsize=’medium’)
ax2.tick_params(labelsize=’large’)
ax3.tick_params(labelsize=15)
参数bottom, top, left, right的值为布尔值,分别代表设置绘图区四个边框线上的的刻度线是否显示
ax1.tick_params(bottom=False,top=True,width=4,colors=’gold’)
ax2.tick_params(left=False,right=True,width=4,colors=’gold’)
ax3.tick_params(top=True,right=True,width=4,colors=’gold’)
参数labelbottom, labeltop, labelleft, labelright的值为布尔值,分别代表设置绘图区四个边框线上的刻度线标签是否显示
ax1.tick_params(labelbottom=False,labeltop=True,width=4,colors=’gold’)
ax2.tick_params(labelleft=False,labelright=True,width=4,colors=’gold’)
ax3.tick_params(labeltop=True,labelright=True,width=4,colors=’gold’)
数据可视化之 tick_params( 参数 )的更多相关文章
- 【Data Visual】一文搞懂matplotlib数据可视化
一文搞懂matplotlib数据可视化 作者:白宁超 2017年7月19日09:09:07 摘要:数据可视化主要旨在借助于图形化手段,清晰有效地传达与沟通信息.但是,这并不就意味着数据可视化就一定因为 ...
- 【Matplotlib】数据可视化实例分析
数据可视化实例分析 作者:白宁超 2017年7月19日09:09:07 摘要:数据可视化主要旨在借助于图形化手段,清晰有效地传达与沟通信息.但是,这并不就意味着数据可视化就一定因为要实现其功能用途而令 ...
- 基于matplotlib的数据可视化 - 笔记
1 基本绘图 在plot()函数中只有x,y两个量时. import numpy as np import matplotlib.pyplot as plt # 生成曲线上各个点的x,y坐标,然后用一 ...
- (在模仿中精进数据可视化05)疫情期间市值增长top25公司
本文完整代码及数据已上传至我的Github仓库https://github.com/CNFeffery/FefferyViz 1 简介 新冠疫情对很多实体经济带来冲击的同时,也给很多公司带来了新的增长 ...
- 数据可视化案例 | 如何打造数据中心APP产品
意识到数据探索带来的无尽信息,越来越多的企业开始建立自有的数据分析平台,打造数据化产品,实现数据可视化. 在零售商超行业,沃尔玛"啤酒与尿布"的故事已不再是传奇.无论是大数据还是小 ...
- 前端数据可视化echarts.js使用指南
一.开篇 首先这里要感谢一下我的公司,因为公司需求上面的新颖(奇葩)的需求,让我有幸可以学习到一些好玩有趣的前端技术,前端技术中好玩而且比较实用的我想应该要数前端的数据可视化这一方面,目前市面上的数据 ...
- [译]学习IPython进行交互式计算和数据可视化(五)
第四章:交互式绘图接口 本章我们将展示Python的绘图功能以及如何在IPython中交互式地使用它们. NumPy为处理大量的多维数组结构的数据提供了高效的方法.但是看行行列列的数字总不如直接看曲线 ...
- [译]学习IPython进行交互式计算和数据可视化(三)
第二章 在本章中,我们将详细学习IPython相对以Python控制台带来的多种改进.特别的,我们将会进行下面的几个任务: 从IPython中使用系统shell以在shell和Python之间进行强大 ...
- 用ElasticSearch和Protovis实现数据可视化
搜索引擎最重要的目的,嗯,不出意料就是搜索.你传给它一个请求,然后它依照相关性返回你一串匹配的结果.我们可以根据自己的内容创造各种请求结构,试验各种不同的分析器,搜索引擎都会努力尝试提供最好的结果. ...
随机推荐
- LINUX 编程定位工具gstack,pstack
pstack: pstack命令可显示每个进程的栈跟踪. pstack 命令必须由相应进程的属主或 root 运行. 可以使用 pstack 来确定进程挂起的位置. 此命令允许使用的唯一选项是要检查的 ...
- 如何在Ubuntu 16.04上安装PythonGDAL 2.1?
sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable sudo apt update sudo apt upgrade # if yo ...
- jdbc之工具类DBUtil的使用
首先回顾一下jdbc的使用方法: 1. 注册驱动 2. 建立连接 3. 建立statement 4. 定义sql语句 5. 执行sql语句,如果执行的是查询需遍历结果集 6. 关闭连接 其中建立连接和 ...
- lnmp mysql远程访问设置
一:iptables 设置开放3306访问 iptables -L -n --line-numbers 1,删除DROP 3306 iptables -D INPUT 5[序列号] 2,添加 ACCE ...
- hadoop过程中遇到的错误与解决方法
本文整理了在hadoop学习过程中遇到的各种问题. windows下开发环境搭建 大部分情况下,我们都是在windows下开发,hadoop则一般部署于linux服务器(无论是CDH还是原生hadoo ...
- python3之platform模块
platform模块可以获取操作系统的相关信息. >>> platform.system() #获取系统名称 'Linux' >>> platform.archit ...
- Linux 我的常用命令记录
Linux下复制粘贴快捷键 1. 在终端下: 复制命令:Ctrl + Shift + C 组合键. 粘贴命令:Ctrl + Shift + V 组合键. 2. 在控制台下: 复制命令:Ctrl + ...
- JS宽高理解
1.clentWidth和clientHeight ①加入无padding.无滚动条显示占据位置 clientWidth=style.width ②假如有padding.无滚动 clientWidth ...
- 让selenium中的Cromerderive不加载图片设置
把配置参数(chrom_opt)设置好后将其添加到 browser = webdriver.Chrome(executable_path="chromedriver.exe的路径" ...
- Easy to Remember Color Guide for Non-Designers
Notes: I'm not a designer. This is what i've self-learnt over the years because i couldn't afford go ...