Python 如何在时钟上绘制点

Python 如何在时钟上绘制点,python,matplotlib,Python,Matplotlib,自从Unix时代开始以来,我有几次是以秒为单位的。我想在24小时时钟上绘制它们。到目前为止,我的努力是成功的 from __future__ import division import matplotlib.pyplot as plt import numpy as np angles = 2*np.pi*np.random.randint(0,864000,100)/86400 ax = plt.subplot(111, polar=True) ax.scatter(angles, np.o

自从Unix时代开始以来,我有几次是以秒为单位的。我想在24小时时钟上绘制它们。到目前为止,我的努力是成功的

from __future__ import division
import matplotlib.pyplot as plt
import numpy as np
angles = 2*np.pi*np.random.randint(0,864000,100)/86400
ax = plt.subplot(111, polar=True)
ax.scatter(angles, np.ones(100)*1)
plt.show()
这就产生了以下结果

然而,这并不是我想要的

  • 我怎样才能把点放在圆周上而不是放在内部(或者至少把它们从中心移得更远)
  • 如何将标签从角度更改为时间
  • 如何摆脱
    0.2、0.4、
  • 基本上,我怎样才能使它看起来更像时钟上标记的点

或者,为了更好地利用时钟的正面,您可以用
条形图替换
散点图
图(其灵感来自:

或者,要使条形图看起来更像记号,可以设置
bottom=0.89

ax.bar(angles, np.full(100, 0.9), width=0.05, bottom=0.89, color='r', linewidth=0)

如果您需要刻度,可以绘制小线段。
# ax.scatter(angles, np.ones(100)*1, marker='_', s=20)
ax.bar(angles, np.full(100, 0.9), width=0.1, bottom=0.0, color='r', linewidth=0)
ax.bar(angles, np.full(100, 0.9), width=0.05, bottom=0.89, color='r', linewidth=0)