极坐标系的极角网格线(thetagrids)的显示刻度

 #!/usr/bin/env python3
#-*- coding:utf-8 -*-
############################
#File Name: polar.py
#Author: frank
#Mail: frank0903@aliyun.com
#Created Time:2018-05-22 22:08:01
############################
import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl zhfont = mpl.font_manager.FontProperties(fname='/usr/share/fonts/truetype/wqy/wqy-microhei.ttc') ax = plt.subplot(111, polar=True) plt.figtext(0.52, 0.95, '默认labels为角度(degree)', ha='center', size=20,fontproperties=zhfont)
plt.thetagrids(np.linspace(0, 360, 6, endpoint=False))
plt.savefig('default_degrees.jpg') plt.figtext(0.52, 0.95, '指定labels', ha='center', size=20,fontproperties=zhfont)
plt.thetagrids(np.linspace(0, 360, 6, endpoint=False), ['a', 'b', 'c', 'd', 'e', 'f'])
plt.savefig('special_degrees.jpg') plt.show()

matplotlib.pyplot.thetagrids(*args, **kwargs)
  Get or set the theta locations of the gridlines in a polar plot.

  get or set 极角轴显示刻度。

If no arguments are passed, return a tuple (lines, labels) where lines is an array of radial gridlines (Line2D instances) and labels is an array of tick labels (Text instances):
  lines, labels = thetagrids()
Otherwise the syntax is:
  lines, labels = thetagrids(angles, labels=None, fmt='%d', frac = 1.1)
  set the angles at which to place the theta grids (these gridlines are equal along the theta dimension).

angles is in degrees.

angles 是角度值,不能是弧度值

labels, if not None, is a len(angles) list of strings of the labels to use at each angle.

If labels is None, the labels will be fmt%angle.

如果labels不为空,那么极角网格线的显示刻度为labels。

如果labels为空,那么极角网格线的显示刻度为 角度值。

frac is the fraction of the polar axes radius at which to place the label (1 is the edge). e.g., 1.05 is outside the axes and 0.95 is inside the axes.

frac 设置 极角显示刻度 距离 极角轴的距离。例如,极径为1,frac=1.1,那么极角的刻度显示的位置 离 r=1的极角网格线 0.1长度。

Return value is a list of tuples (lines, labels):
  lines are Line2D instances
  labels are Text instances.

Note that on input, the labels argument is a list of strings, and on output it is a list of Text instances.

reference: https://matplotlib.org/api/_as_gen/matplotlib.pyplot.thetagrids.html?highlight=thetagrids#matplotlib.pyplot.thetagrids

最新文章

  1. 用C#实现MD5的加密(转载)
  2. grunt压缩合并代码
  3. UI组件之Group
  4. codeforce626D (概率)
  5. PLSQL插入数据中文乱码的问题
  6. Linux 学习笔记 基本的bash shell命令
  7. effective c++(07)之为多态基类声明virtual析构函数
  8. 《编程简介(Java) ·10.3递归思想》
  9. vue的双向绑定原理及实现
  10. java变量与内存深入了解
  11. JVM-GC学习
  12. 【 HDU2966 】In case of failure(KD-Tree)
  13. spring cloud(学习笔记)高可用注册中心(Eureka)的实现(二)
  14. 如何搭建WebRTC信令服务器
  15. Cookie-base 认证实现(学习笔记)
  16. 向windows添加环境变量
  17. 【树莓派+.NET MF打造视频监控智能车】控制篇(树莓派)
  18. Tasker to answer incoming call by pressing power button
  19. 通过源码了解ASP.NET MVC 几种Filter的执行过程 在Winform中菜单动态添加“最近使用文件”
  20. threejs的学习笔记

热门文章

  1. [UML] UML中类之间的几种关系
  2. 16、Xtrabackup备份与恢复
  3. CKFinder的_thumbs缓存文件夹
  4. 【转载】C/C++语言分析 & 每年学一种编程语言 & git历史
  5. String格式化参数整理
  6. jQuery-实现全选与反选
  7. 关于判断语句中如:while not xx: 或者:if not xx: 的含义及用法解析
  8. Linux系统443端口被占用无法启动解决办法
  9. Python函数:使用谷歌翻译翻译英语字符串
  10. 倍福TwinCAT(贝福Beckhoff)常见问题(FAQ)-为什么没有自动识别成标准FBD功能块