Call the ax.bar method to add the "Gold" medals. Call it with the label set to "Gold". Call the ax.bar method to stack "

动态 未结 0 80
小小草
小小草 LV1 2023年9月23日 23:40 发表
下面是完整代码: ```python # Add bars for "Gold" with the label "Gold" ax.bar(medals.index, medals["Gold"], label="Gold") # Stack bars for "Silver" on top with label "Silver" ax.bar(medals.index, medals["Silver"], bottom=medals["Gold"], label="Silver") # Stack bars for "Bronze" on top of that with label "Bronze" ax.bar(medals.index, medals["Bronze"], bottom=medals["Gold"]+medals["Silver"], label="Bronze") # Display the legend ax.legend() plt.show() ```
收藏(0)  分享
相关标签: 智能问答
问题没解决?让AI助手帮你作答 AI助手
0个回复
  • 消灭零回复