来几个pyecharts.charts.Pie的例子
时间: 2023-03-26 07:01:05 浏览: 119
好的,以下是几个pyecharts.charts.Pie的例子:
1. 简单的饼图
```python
from pyecharts.charts import Pie
data = [('A', 10), ('B', 20), ('C', 30), ('D', 40)]
pie = Pie()
pie.add('', data)
pie.render('simple_pie.html')
```
2. 带有标签和百分比的饼图
```python
from pyecharts.charts import Pie
data = [('A', 10), ('B', 20), ('C', 30), ('D', 40)]
pie = Pie()
pie.add('', data, radius=['30%', '50%'], label_opts=opts.LabelOpts(formatter="{b}: {d}%"))
pie.render('labeled_pie.html')
```
3. 环形饼图
```python
from pyecharts.charts import Pie
data = [('A', 10), ('B', 20), ('C', 30), ('D', 40)]
pie = Pie()
pie.add('', data, radius=['40%', '55%'])
pie.set_global_opts(title_opts=opts.TitleOpts(title="环形饼图"))
pie.render('donut_pie.html')
```
希望这些例子能够帮助你!
阅读全文