美文网首页
Matplotlib: pieplot

Matplotlib: pieplot

作者: LET149 | 来源:发表于2023-08-24 09:52 被阅读0次
import matplotlib.pyplot as plt
import numpy as np

plt.style.use('_mpl-gallery-nogrid')


# make data
x = [1, 2, 3, 4]
colors = plt.get_cmap('Blues')(np.linspace(0.2, 0.7, len(x)))

# plot
fig, ax = plt.subplots()
ax.pie(x, colors=colors, radius=3, center=(4, 4),
       wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True)

ax.set(xlim=(0, 8), xticks=np.arange(1, 8),
       ylim=(0, 8), yticks=np.arange(1, 8))

plt.show()
image.png

2. 参数

相关文章

网友评论

      本文标题:Matplotlib: pieplot

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