【发布时间】:2020-08-28 22:06:17
【问题描述】:
import matplotlib.pyplot as plt
plt.style.use("fivethirtyeight")
plt.title("sub count of most popular czech youtubers")
plt.tight_layout()
slices = (2770000, 1360000, 1190000, 1120000, 918000)
labels = ("ViralBrothers", "MenT," "Gejmr", "JirkaKrál", "PedrosGames")
colors = ("white", "green", "blue", "yellow", "blue")
plt.pie(slices, labels=labels, colors=colors, wedgeprops={"edgecolor":"black"})
plt.show()
这是我的代码,但是当我运行它时,它不显示饼图。它只给了我这个:
【问题讨论】:
-
Misplaced
,inlabels,"MenT," "Gejmr"默默地连接到"MenT,Gejmr"使得列表只有 4 个元素长。投票结束简单的错字。 -
此代码生成错误消息。仔细阅读此类消息并采取适当的措施通常是个好主意。
标签: python matplotlib pie-chart