Matplotlib极坐标图未在应绘制的位置绘制

罗曼·罗兹(Roman Rdgz)

我尝试在极坐标图中以度数表示球坐标方位角和仰角。我有一组值可以测试0度,90度,180度和270度,并且可以清楚地看到它们并未以应有的方位角值绘制。

代码:

from matplotlib.pyplot import rc, grid, figure, plot, rcParams, savefig


def generate_satellite_plot(observer_lat, observer_lon):
    rc('grid', color='#316931', linewidth=1, linestyle='-')
    rc('xtick', labelsize=15)
    rc('ytick', labelsize=15)

    # force square figure and square axes looks better for polar, IMO
    width, height = rcParams['figure.figsize']
    size = min(width, height)
    # make a square figure
    fig = figure(figsize=(size, size))

    ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c')
    ax.set_theta_zero_location('N')
    ax.set_theta_direction(-1)

    sat_positions = [[1, 30, 0], [2, 60, 90], [3, 30, 180], [4, 50, 270]]
    for (PRN, E, Az) in sat_positions:
        ax.annotate(str(PRN),
                    xy=(Az, 90-E),  # theta, radius
                    bbox=dict(boxstyle="round", fc = 'green', alpha = 0.5),
                    horizontalalignment='center',
                    verticalalignment='bottom')


    ax.set_yticks(range(0, 90, 10))                   # Define the yticks
    yLabel = ['90', '', '', '60', '', '', '30', '', '', '']
    ax.set_yticklabels(yLabel)
    grid(True)

    savefig('foo.png')

这是结果,显然是不准确的: 在此处输入图片说明

我更改了轴,使它们从0度开始,然后沿顺时针方向旋转,并且半径表示高程(从圆心的90º到边界的0º)。

翁扎洛

迟了,但是:

代码:

from matplotlib.pyplot import rc, grid, figure, plot, rcParams, savefig
from math import radians

def generate_satellite_plot(observer_lat, observer_lon):
    rc('grid', color='#316931', linewidth=1, linestyle='-')
    rc('xtick', labelsize=15)
    rc('ytick', labelsize=15)

    # force square figure and square axes looks better for polar, IMO
    width, height = rcParams['figure.figsize']
    size = min(width, height)
    # make a square figure
    fig = figure(figsize=(size, size))

    ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c')
    ax.set_theta_zero_location('N')
    ax.set_theta_direction(-1)

    sat_positions = [[1, 30, 0], [2, 60, 90], [3, 30, 180], [4, 50, 270]]
    for (PRN, E, Az) in sat_positions:
        ax.annotate(str(PRN),
                    xy=(radians(Az), 90-E),  # theta, radius
                    bbox=dict(boxstyle="round", fc = 'green', alpha = 0.5),
                    horizontalalignment='center',
                    verticalalignment='center')


    ax.set_yticks(range(0, 90+10, 10))                   # Define the yticks
    yLabel = ['90', '', '', '60', '', '', '30', '', '', '']
    ax.set_yticklabels(yLabel)
    grid(True)

    savefig('foo.png')

结果:

在此处输入图片说明

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何绘制极坐标图?

来自分类Dev

Matplotlib-在极坐标图中绘制平滑圆

来自分类Dev

matplotlib极坐标图设置标签位置

来自分类Dev

Matplotlib:极坐标图坐标轴刻度标签位置

来自分类Dev

如何根据平均值绘制pyplot极坐标图

来自分类Dev

如何解决Scilab中绘制极坐标图的错误

来自分类Dev

使用scilab绘制极坐标图时出错

来自分类Dev

在散点图中绘制小极坐标图-Python

来自分类Dev

如何更改matplotlib极坐标图的“ r”轴位置?

来自分类Dev

要绘制极坐标图,按第1列的顺序指向哪里?

来自分类Dev

HighCharts:极坐标图未在其框架中拉伸

来自分类Dev

极值极坐标图

来自分类Dev

极坐标图错误

来自分类Dev

极坐标图软件

来自分类Dev

极坐标图生成

来自分类Dev

极坐标图软件

来自分类Dev

Gnuplot在极坐标中绘制离散弧

来自分类Dev

使用极坐标在Python中绘制相像

来自分类Dev

如何在SAGE中绘制极坐标?

来自分类Dev

python matplolib极坐标图x轴标签位置

来自分类Dev

在matplotlib极坐标图中设置theta-ticks

来自分类Dev

在matplotlib极坐标图上旋转theta = 0

来自分类Dev

在matplotlib中的极坐标图上移动径向刻度标签

来自分类Dev

极坐标图多边形的Python / Matplotlib逆填充

来自分类Dev

极坐标图在matplotlib中给出了错误的角度

来自分类Dev

极坐标图多边形的Python / Matplotlib逆填充

来自分类Dev

如何在matplotlib中设置极坐标图的大小?

来自分类Dev

如何在 matplotlib 中计算极坐标图密度

来自分类Dev

如何使用Matplotlib用极坐标中的轮廓密度线绘制散点图?