[英]How to plot probability density function of circular statistics around a circle in python?
我需要在python中围绕一个圆圈绘制圆形统计数据的pdf曲线。 我知道它在 R 语言中的表现,但我在网上找不到它的 python 示例。 我只找到圆形直方图的例子作为输入链接描述here
请帮忙。
您需要在matplotlib
使用polar
图。 这是一个例子: https : //matplotlib.org/3.3.1/gallery/misc/transoffset.html#sphx-glr-gallery-misc-transoffset-py
如果要绘制列表y
,请按以下步骤操作。
import matplotlib.pyplot as plt
import math
# create equispaced angles (in radians)
xs = [i / len(y) * 2 *math.pi for i in range(len(y))]
# to make a good circle, duplicate the first entry
xs.append(0)
y.append(y[0])
# plot
plt.polar(xs, y)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.