<bdo id='w2SPi'></bdo><ul id='w2SPi'></ul>

    1. <legend id='w2SPi'><style id='w2SPi'><dir id='w2SPi'><q id='w2SPi'></q></dir></style></legend>

    2. <i id='w2SPi'><tr id='w2SPi'><dt id='w2SPi'><q id='w2SPi'><span id='w2SPi'><b id='w2SPi'><form id='w2SPi'><ins id='w2SPi'></ins><ul id='w2SPi'></ul><sub id='w2SPi'></sub></form><legend id='w2SPi'></legend><bdo id='w2SPi'><pre id='w2SPi'><center id='w2SPi'></center></pre></bdo></b><th id='w2SPi'></th></span></q></dt></tr></i><div id='w2SPi'><tfoot id='w2SPi'></tfoot><dl id='w2SPi'><fieldset id='w2SPi'></fieldset></dl></div>
    3. <tfoot id='w2SPi'></tfoot>

      <small id='w2SPi'></small><noframes id='w2SPi'>

    4. Matplotlib - 在极坐标图中绘制一个平滑的圆

      时间:2023-09-11
        <tbody id='LFKEo'></tbody>

        <small id='LFKEo'></small><noframes id='LFKEo'>

        <legend id='LFKEo'><style id='LFKEo'><dir id='LFKEo'><q id='LFKEo'></q></dir></style></legend>
      1. <i id='LFKEo'><tr id='LFKEo'><dt id='LFKEo'><q id='LFKEo'><span id='LFKEo'><b id='LFKEo'><form id='LFKEo'><ins id='LFKEo'></ins><ul id='LFKEo'></ul><sub id='LFKEo'></sub></form><legend id='LFKEo'></legend><bdo id='LFKEo'><pre id='LFKEo'><center id='LFKEo'></center></pre></bdo></b><th id='LFKEo'></th></span></q></dt></tr></i><div id='LFKEo'><tfoot id='LFKEo'></tfoot><dl id='LFKEo'><fieldset id='LFKEo'></fieldset></dl></div>
        <tfoot id='LFKEo'></tfoot>
            <bdo id='LFKEo'></bdo><ul id='LFKEo'></ul>

              1. 本文介绍了Matplotlib - 在极坐标图中绘制一个平滑的圆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我真的很喜欢 matplotlib 的极坐标图,并且很想继续使用它(因为无论如何我的数据点都是在极坐标中给出的,而且我的环境是圆形的).

                I really like the polar plot of matplotlib and would love to keep working with it (since my data points are given in polar coordinates anyway and my environment is circular).

                但是,在情节中,我想在特定点添加给定半径的圆.

                However, in the plot, I would like to add circles of given radii at specific points.

                通常,我会这样做:

                 ax = plt.subplot(111)
                 ax.scatter(data)
                 circle = plt.Circle((0,0), 0.5)
                 ax.add_artist(circle)
                 plt.show()
                

                但是,在极坐标中,我不能使用圆形,因为它采用直角坐标.

                However, in polar coordinates, I cannot use circle, since it assumes rectangular coordinates.

                我想出的想法是:生成具有恒定径向坐标和 [0, 2PI] 中的角坐标的点数组或完全切换到直角坐标.两种解决方案都不太令人满意 - 使用 matplotlib 可以做得更好吗?

                Ideas I have come up with are: generating an array of points with constant radial coordinate and an angular coordinate in [0, 2PI] or completely switching to rectangular coordinates. Both solutions are not really satisfactory - can one do any better with matplotlib?

                谢谢!

                推荐答案

                可以设置Circletransform参数:

                %matplotlib inline
                import pylab as pl
                import numpy as np
                
                N = 100
                theta = np.random.rand(N)*np.pi*2
                r = np.cos(theta*2) + np.random.randn(N)*0.1
                
                ax = pl.subplot(111, polar=True)
                ax.scatter(theta, r)
                circle = pl.Circle((0.5, 0.3), 0.2, transform=ax.transData._b, color="red", alpha=0.4)
                ax.add_artist(circle)
                

                输出:

                transform=ax.transProjectionAffine + ax.transAxes 如果您不喜欢使用私有属性.

                or transform=ax.transProjectionAffine + ax.transAxes if you don't like using the private attribute.

                这篇关于Matplotlib - 在极坐标图中绘制一个平滑的圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:x,y 的匹配集指向另一个已缩放、旋转、平移且缺 下一篇:如何在嵌入 3D 的表面上绘制测地线曲线?

                相关文章

                最新文章

              2. <legend id='8Na2k'><style id='8Na2k'><dir id='8Na2k'><q id='8Na2k'></q></dir></style></legend>

                <small id='8Na2k'></small><noframes id='8Na2k'>

                <i id='8Na2k'><tr id='8Na2k'><dt id='8Na2k'><q id='8Na2k'><span id='8Na2k'><b id='8Na2k'><form id='8Na2k'><ins id='8Na2k'></ins><ul id='8Na2k'></ul><sub id='8Na2k'></sub></form><legend id='8Na2k'></legend><bdo id='8Na2k'><pre id='8Na2k'><center id='8Na2k'></center></pre></bdo></b><th id='8Na2k'></th></span></q></dt></tr></i><div id='8Na2k'><tfoot id='8Na2k'></tfoot><dl id='8Na2k'><fieldset id='8Na2k'></fieldset></dl></div>
                <tfoot id='8Na2k'></tfoot>

                  <bdo id='8Na2k'></bdo><ul id='8Na2k'></ul>