0

I need to plot the pdf curve of circular statistic data around a circle in python. I konw how it does in R language, but I could not find the python example for it in the web. I only found the example of circular histogram as enter link description here

Please help.

1 Answers1

0

You need to use the polar plot in matplotlib. Here is an example: https://matplotlib.org/3.3.1/gallery/misc/transoffset.html#sphx-glr-gallery-misc-transoffset-py

If you want to plot the list y, here are the steps.

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)
Kate Melnykova
  • 1,863
  • 1
  • 5
  • 17
  • Thank you for your help. But could you please give the complete code so that i can run and see? By the way, I want to plot a pdf curve like vonmises curve over a circle, not descrete points. – ZHENGZhuang Oct 13 '20 at 07:41
  • Use https://stackoverflow.com/questions/4150171/how-to-create-a-density-plot-in-matplotlib to generate the density function. Plot it as above. – Kate Melnykova Oct 13 '20 at 18:16