figures.py 文件源码

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

项目:odin 作者: imito 项目源码 文件源码
def generate_random_colors(n, seed=5218):
  if seed is not None:
    np.random.seed(seed)
  colors = []
  for i in range(n):
    hue = 0.05 + i / n # we want maximizing hue
    lightness = 0.4 + np.random.rand(1)[0] / 3  # lightness
    saturation = 0.5 + np.random.rand(1)[0] / 10 # saturation
    rgb = colorsys.hls_to_rgb(hue, lightness, saturation)
    colors.append(rgb)
  return colors


# ===========================================================================
# Helper for spectrogram
# ===========================================================================
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号