plot.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:biotracks 作者: CellMigStandOrg 项目源码 文件源码
def plot_polar(theta, N):
    """Plot polar plot.

    theta -- the dataframe with the turning angles
    N -- number of bins to use
    """
    hist, bins = np.histogram(theta.ta, bins=N)

    # the width of the bins interval
    width = [t - s for s, t in zip(bins, bins[1:])]
    bins_ = bins[0:N]  # exclude the last value

    # the actual plotting logic
    g = sns.FacetGrid(theta, size=4)

    radii = hist / max(hist)

    for ax in g.axes.flat:
        ax2 = plt.subplot(111, projection='polar')
        bars = ax2.bar(bins_, radii, width, bottom=0.0)
        for r, bar in zip(radii, bars):
            bar.set_facecolor(plt.cm.Spectral(r))
            bar.set_alpha(0.5)

    sns.plt.savefig("turning_angles.png")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号