码迷,mamicode.com
首页 > 其他好文 > 详细

matplotlib之设置极坐标起点的位置

时间:2018-05-23 13:44:21      阅读:468      评论:0      收藏:0      [点我收藏+]

标签:with   tps   from   nts   .project   file   off   port   python3   

 1 #!/usr/bin/env python3
 2 #-*- coding:utf-8 -*-
 3 ############################
 4 #File Name: polar.py
 5 #Author: frank
 6 #Mail: frank0903@aliyun.com
 7 #Created Time:2018-05-22 22:08:01
 8 ############################
 9 import matplotlib.pyplot as plt
10 import numpy as np
11 import matplotlib as mpl
12 
13 zhfont = mpl.font_manager.FontProperties(fname=/usr/share/fonts/truetype/wqy/wqy-microhei.ttc)#载入中文字符库,否则会显示乱码
14 
15 plt.subplots_adjust(wspace=0.3)#控制两个subplot的间距,否则会有部分标签重叠
16 ax1 = plt.subplot(121, polar=True)
17 ax2 = plt.subplot(122, polar=True)
18 
19 #ax2.set_theta_zero_location("N")   #将起点位置设为 北部
20 ax2.set_theta_zero_location("N", 30.0)#将起点位置设为 北部 偏移30度的位置,偏移的方向总是逆时针方向,无论theta direction的顺时针或逆时针。
21 
22 plt.figtext(0.52, 0.95, 设置极坐标(ρ, 0)的位置, ha=center, size=20,fontproperties=zhfont)#设置figure的标题
23 plt.savefig(0_degrees.jpg)
24 plt.show()

 

技术分享图片

set_theta_zero_location(loc, offset=0.0)
  Sets the location of theta’s zero. (Calls set_theta_offset with the correct value in radians under the hood.)

loc : str
  May be one of “N”, “NW”, “W”, “SW”, “S”, “SE”, “E”, or “NE”.
offset : float, optional
  An offset in degrees to apply from the specified loc. Note: this offset is always applied counter-clockwise regardless of the direction setting.

 

reference: https://matplotlib.org/api/projections_api.html?highlight=set_theta_zero_location#matplotlib.projections.polar.PolarAxes.set_theta_zero_location

matplotlib之设置极坐标起点的位置

标签:with   tps   from   nts   .project   file   off   port   python3   

原文地址:https://www.cnblogs.com/black-mamba/p/9076388.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!