在 matplotlib 极坐标图上旋转 theta=0 [英] Rotate theta=0 on matplotlib polar plot

查看:80
本文介绍了在 matplotlib 极坐标图上旋转 theta=0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下示例代码:

import numpy as np
import matplotlib.pyplot as plt
import random

data_theta = range(10,171,10)

data_theta_rad = []
for i in data_theta:
    data_theta_rad.append(float(i)*np.pi/180.0)

data_r = random.sample(range(70, 90), 17)

print data_theta
print data_r

ax = plt.subplot(111, polar=True)
ax.plot(data_theta_rad, data_r, color='r', linewidth=3)
ax.set_rmax(95)
# ax.set_rmin(70.0)
ax.grid(True)

ax.set_title("Example", va='bottom')
plt.show()

...产生如下内容:

...但我想将 theta=0 设置为West".所以像:

...but I would like to set theta=0 to the 'West'. So something like:

任何想法如何使用 matplotlib 执行此操作(我在 PowerPoint 中制作了下面的图片)?

Any ideas how to do this with matplotlib (I made the pic below in powerpoint) ?

推荐答案

简单使用:

ax.set_theta_zero_location("W")

文档中的更多信息 matplotlib.

More info in the documentation of matplotlib.

这篇关于在 matplotlib 极坐标图上旋转 theta=0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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