hupili / python-for-data-and-media-communication-gitbook

An open source book on Python tailed for communication students with zero background
117 stars 62 forks source link

Pyecharts 多个饼图 #132

Closed AlexZenghuashan closed 5 years ago

AlexZenghuashan commented 5 years ago

Troubleshooting

Describe your environment

Describe your question

Pyecharts 多个饼图,按照http://pyecharts.org/#/zh-cn/charts_base的教学无法成功显示。 image 如果我define了Style image 依然不能成功,请问这里的代码应如何写呢? Example: I get IOError when running my script to load files.

The minimum code (snippet) to reproduce the issue

import pyecharts from pyecharts import Pie

pie = Pie('分类浏览中点赞超50的"受欢迎文章"所占的比例', "数据来源:人人都是产品经理", title_pos='center') Style=[] style = Style() pie_style = style.add(label_pos="center", is_label_show=True, label_text_color=None) pie.add("", ["AI人工智能", ""], [25, 75], center=[15, 30], radius=[18, 24], pie_style) pie.add("", ["blockchain", ""], [24, 76], center=[30, 30], radius=[18, 24], pie_style) pie.add("", ["业界动态", ""], [14, 86], center=[45, 30], radius=[18, 24], pie_style) pie.add("", ["交互体验", ""], [11, 89], center=[60, 30], radius=[18, 24], pie_style) pie.add("", ["产品经理", ""], [27, 73], center=[75, 30], radius=[18, 24], pie_style) pie.add("", ["产品运营", ""], [15, 85], center=[90, 30], radius=[18, 24], pie_style) pie.add("", ["分析评测", ""], [54, 46], center=[15, 75], radius=[18, 24], pie_style) pie.add("", ["创业学院", ""], [26, 74], center=[30, 75], radius=[18, 24], pie_style) pie.add("", ["职场攻略", ""], [26, 74], center=[45, 75], radius=[18, 24], pie_style) pie.add("", ["营销推广", ""], [26, 74], center=[60, 75], radius=[18, 24], pie_style) pie.add("", ["原型设计", ""], [25, 75], center=[75, 75], radius=[18, 24], pie_style) pie.add("", ["产品设计", ""], [28, 72], center=[90, 75], radius=[18, 24], legend_top="center", pie_style) pie.render() pie

open('path-to-a-file-not-exist')
ChicoXYC commented 5 years ago

@AlexZenghuashan Its the pyecharts problem. You may solve the problem by add this line at the beginning

from pyecharts import Style

image

AlexZenghuashan commented 5 years ago

Problem is solved. Thank you!