在matplotlib中的极坐标图上移动径向刻度标签 [英] Move radial tick labels on a polar plot in matplotlib

查看:49
本文介绍了在matplotlib中的极坐标图上移动径向刻度标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自,有点隐藏在投影"之下.

添加上面的行会产生(我没有 seaborn,所以它具有默认的 matplotlib 格式):

在1.4之前, ax.set_rgrids 可以使用angle参数.

From matplotlib examples:

import numpy as np
import seaborn as sbs
import matplotlib.pyplot as plt

r = np.arange(0, 3.0, 0.01)
theta = 2 * np.pi * r

ax = plt.subplot(111, polar=True)
ax.plot(theta, r, color='r', linewidth=3)
ax.set_rmax(2.0)
ax.grid(True)

ax.set_title("A line plot on a polar axis", va='bottom')
plt.show()

How to move the radial tick labels (0.5, 1.0, 1.5, 2.0) to a different angle, say 120 deg?

解决方案

With version 1.4 or later, you can use "set_rlabel_position". e.g. to place the radial ticks a long a line at, say, 135 degrees:

ax.set_rlabel_position(135)

The relevant documentation is residing here, a bit hidden under "projections".

Adding the line above yields (I don't have seaborn so this has default matplotlib formatting):

Prior to 1.4, ax.set_rgrids can take an angle argument.

这篇关于在matplotlib中的极坐标图上移动径向刻度标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆