Python pyecarts drawing pie chart

2022-01-27 03:06:21

One 、pyecharts Introduction to pie chart Syntax

Pie chart is mainly used to show the proportion of different categories of data in the total . The radian of each is not the proportion of data volume
center=None,
rosetype=None, **kwargs)
name->str legend title
attr->list The attribute name
value->list Value corresponding to property
radius->list The radius of the pie , The first item in the array is the inner radius , The second term is the outer radius , The default is [0,75]
The default setting is percentage , Relative to half of the smaller item in the height and width of the container
center-> The coordinates of the center of the pie chart , The first item in the array is the abscissa , The second is the ordinate , The default is [50,50]
The default setting is percentage , When set as a percentage, the first item is relative to the height of the container , The second item is also relative to the height of the container
rosetype->str
Is it shown as a nightingale map . Size data by radius , Yes radius and area Two modes . The default is radius
radius: The percentage of data presented by the sector center angle , Radius shows the size of the data
area: All sectors have the same center angle , Show data size by radius only

Two 、 Draw a normal pie chart

```attr = [" shirt ", " Woolen sweater ", " Snow spins unlined upper garment ", " The trousers ", " High heels ", " socks "]
v1 = [11, 12, 13, 10, 10, 10]
pie1 = Pie(" Pie chart example ")

3、 ... and 、 Draw a circle

```attr = [" shirt ", " Woolen sweater ", " Snow spins unlined upper garment ", " The trousers ", " High heels ", " socks "]
v1 = [11, 12, 13, 10, 10, 10]
pie2 = Pie(" The pie chart - An example of a doughnut ", title_pos='center')
"",
attr,
v1,
label_text_color=None,
is_label_show=True,
legend_orient="vertical",
legend_pos="left",
)

Four 、 Draw the pie chart - Rose chart

```attr = [" shirt ", " Woolen sweater ", " Snow spins unlined upper garment ", " The trousers ", " High heels ", " socks "]
v1 = [11, 12, 13, 10, 10, 10]
v2 = [19, 21, 32, 20, 20, 33]
pie3 = Pie(" The pie chart - An example of a rose chart ")
" goods A",
attr,
v1,
is_random=True,
is_label_show=True,
)

attr = [" shirt ", " Woolen sweater ", " Snow spins unlined upper garment ", " The trousers ", " High heels ", " socks "]
v1 = [11, 12, 13, 10, 10, 10]
v2 = [19, 21, 32, 20, 20, 33]
pie4 = Pie(" The pie chart - An example of a rose chart ")
" goods B",
attr,
v2,
#center=[75, 50],
is_random=True,
rosetype="area",
is_legend_show=True,
is_label_show=True,
)