我试图将Pichart添加到Excel文件中
continue
i'm trying to add the piechart to an excel sheet and i can't seem to understand what i've done wrong
game_name = ['Rocket League','FIFA 19','FIFA 18', 'FIFA 17', 'FIFA Online 3','FIFA 20' ,'Madden NFL 2017','NBA 2K18','FIFA Online 4']
money=['9171818.72 ', '3242642.34 ', '2233697.69', '2233697.69', '1482612.63',' 1434341.90', '1144673.72 ', ' 1004000.00','1000000.00']
explode=(0.1,0,0,0,0,0,0,0,0)
plt.style.use('ggplot')
plt.title('les jeux ayant le plus de gain')
fig3= plt.pie(x=money, explode=explode, labels=game_name, shadow=True, startangle=90,autopct='%.2f%%')
plt.axis('equal')
plt.legend(loc='upper left')
plt.show()
#plt.savefig('piechart.png')
sht.pictures.add(
fig3,
left=sht.range("A103").left,
top= sht.range("A103").top,
height=300,
width=500,
)
i'm gettiing this error "don't know what to do with that image object"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
.insert_image()
use
.insert_image()
如果要添加一个饼图以表现出色,则可以使用XLSXWriter直接进行操作,而不是添加图像。像这样的东西:
输出:
If you want to add a pie chart to Excel you could do it directly using XlsxWriter, rather than adding an image. Something like this:
Output: