在matplotlib极坐标图中设置theta-ticks [英] Setting theta-ticks in matplotlib polar plots
本文介绍了在matplotlib极坐标图中设置theta-ticks的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的问题与以下内容有关:matlab 中的散点极坐标图
My question is related to the following: Scatter polar plot in matlab
我尝试在网上查找,但找不到与此轴相关的任何内容;而不是将极坐标图从0到360度旋转,我该怎么做-180到180度?
I tried looking online but couldn't find any with this axis; instead of the polar plot going 0 to 360 degrees how can I do -180 to 180 instead?
推荐答案
创建极轴后,您可以简单地设置刻度.请注意,您必须将刻度设置为弧度,并且matplotlib将以度为单位显示.
After creating the polar axis, you can simply set the ticks. Note that you have to set the ticks in radians and matplotlib will display in degrees.
不太确定您想如何处理 180 和 -180 的差异.
Not quite sure how you want to deal the discrepancy at 180 and -180.
import matplotlib.pyplot as plt
fig, ax1 = plt.subplots(figsize=(6, 6), subplot_kw=dict(polar=True))
ax1.set_xticks(np.pi/180. * np.linspace(180, -180, 8, endpoint=False))
这篇关于在matplotlib极坐标图中设置theta-ticks的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文