美文网首页
Scatter plot on polar axis

Scatter plot on polar axis

作者: 榴莲气象 | 来源:发表于2019-05-24 07:54 被阅读0次

Scatter plot on polar axis

import numpy as np
import matplotlib.pyplot as plt

# Fixing random state for reproducibility
[np.random.seed](https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.seed.html#numpy.random.seed "View documentation for numpy.random.seed")(19680801)

# Compute areas and colors
N = 150
r = 2 * [np.random.rand](https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.rand.html#numpy.random.rand "View documentation for numpy.random.rand")(N)
theta = 2 * [np.pi](https://docs.scipy.org/doc/numpy/reference/constants.html#numpy.pi "View documentation for numpy.pi") * [np.random.rand](https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.rand.html#numpy.random.rand "View documentation for numpy.random.rand")(N)
area = 200 * r**2
colors = theta

fig = [plt.figure](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.figure.html#matplotlib.pyplot.figure "View documentation for matplotlib.pyplot.figure")()
ax = fig.add_subplot(111, projection='polar')
c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)</pre>

相关文章

网友评论

      本文标题:Scatter plot on polar axis

      本文链接:https://www.haomeiwen.com/subject/yodwzqtx.html