python - pyecharts Visualization of "two" - Dynamic graphics Advanced [Statistics used Chart - visual feast]

1, pyecharts mounting Introduction

       Baidu is to call the ECharts and python interface. ECharts English word for Enterprise Charts, graphs do business-grade data, is Baidu's open source data visualization tools. We use the python pyecharts library, just a few lines of code to draw a shining picture. It is not hard to learn. Of course, if you do not, then install pyecharts look at my suggestion pyecharts installation guide, full of success! [PS: If you are sure there will be a variety of problems from other sources installed, do not worry my tutorial]
pyecharts Installation Tutorial: Installation unsuccessful me give you a head when the ball
pyecharts official website describes the various parameters
pyecharts official website
if that example click here to see the color does not look good on a color code table, choose your favorite color replacement

2, pyecharts drawing realize anaconda (the picture is dynamic, showing still pictures here)

       If you do not like the color example, you can click here and then into your favorite color!

2.1 Creating Dynamic - parallel to the coordinate system

from pyecharts import Parallel  #平行坐标系--数据纯属虚构
c_schema =[ {"dim": 0, "name": "评分1"}, {"dim": 1, "name": "评分2"}, {"dim": 2, "name": "评分3"},
             {"dim": 3, "name": "评分4"}, {"dim": 4, "name": "评分5"}, {"dim": 5, "name": "评分6"},
             {"dim": 6, "name": "评分7"}, {"dim": 7, "name": "最终得分", "type": "category", 
                                         "data": [ '极差', '差','良好','高度良好','优秀', '及其优秀' ]}]
data =[ [1, 91, 45, 125, 0.82, 34, 23, "优秀"], [2, 65, 27, 78, 0.86, 45, 29, "优秀"],
       [3, 83, 60, 84, 1.09, 73, 27, "优秀"], [4, 109, 81, 121, 1.28, 68, 51, "极差"], 
       [5, 106, 77, 114, 1.07, 55, 51, "极差"], [6, 109, 81, 121, 1.28, 68, 51, "极差"], 
       [7, 106, 77, 114, 1.07, 55, 51, "极差"], [8, 89, 65, 78, 0.86, 51, 26, "优秀"], 
       [9, 53, 33, 47, 0.64, 50, 17, "优秀"], [10, 80, 55, 80, 1.01, 75, 24, "优秀"], 
       [11, 117, 81, 124, 1.03, 45, 24, "极差"], [12, 99, 71, 142, 1.1, 62, 42, "优秀"],
       [13, 95, 69, 130, 1.28, 74, 50, "优秀"], [14, 116, 87, 131, 1.47, 84, 40, "极差"]]
parallel =Parallel("平行坐标系-评分",background_color='#00ffff')
parallel.config(c_schema=c_schema)
parallel.add("parallel", data)
parallel.show_config()
parallel.render()

Here Insert Picture Description

2.2 to create dynamic - Pie

from pyecharts import Pie  #饼图
attr =['戏剧','喜剧','动作','惊悚','爱情','恐怖片']
v1 =[25.02,18.73,7.85,7.68,7.35,5.35]
pie =Pie("电影类型占比",background_color='#00ffff')
pie.add("", attr, v1, is_label_show=True)
pie.show_config()
pie.render()

Here Insert Picture Description

2.3 Dynamic Production - annular roses

from pyecharts import Pie  #环形 玫瑰图
attr =['戏剧','喜剧','动作','惊悚','爱情','恐怖片']
v1 =[25.02,18.73,7.85,7.68,7.35,5.35]
v2 =[7.35,5.35,4.42,4.31,3.92,3.29]
pie =Pie("玫瑰图示例", title_pos='center', width=900,background_color='#00ffff')#title_pos 标题在中间
pie.add("观众1", attr, v1, center=[25, 50], is_random=True, radius=[30, 75], #is_random 眼色随机生成
        rosetype='radius',is_legend_show=False, is_label_show=True)
pie.add("观众2", attr, v2, center=[75, 50], is_random=True, radius=[30, 75], 
        rosetype='area', is_legend_show=False, is_label_show=True) #is_legend_show显示指示
pie.show_config()
pie.render()

Here Insert Picture Description

2.4 Create dynamic - a polar coordinate system [stacked]

from pyecharts import Polar  # 极坐标系,堆叠柱状图
radius =['戏剧','喜剧','动作','惊悚','爱情','恐怖片','冒险']
polar =Polar("极坐标系-堆叠柱状图", width=1200, height=600,title_pos='center',
             background_color='#00ffff',title_top='5%') #title_top标题与顶部的距离
polar.add("观众1", [1, 2, 3, 4, 3, 5, 1], radius_data=radius, type='barRadius', is_stack=True)
polar.add("观众2", [2, 4, 6, 1, 2, 3, 1], radius_data=radius, type='barRadius', is_stack=True)
polar.add("观众3", [1, 2, 3, 4, 1, 2, 5], radius_data=radius, type='barRadius', is_stack=True)
#type 替换堆叠形状
polar.show_config()
polar.render()

Here Insert Picture Description

2.5 Dynamic Production - Rose polar coordinates [stacked]

from pyecharts import Polar  # 极坐标系,堆叠柱状图
radius =['戏剧','喜剧','动作','惊悚','爱情','恐怖片','冒险']
polar =Polar("极坐标系-堆叠柱状图", width=1200, height=600,title_pos='center',
             background_color='#00ffff',title_top='5%') #title_top标题与顶部的距离
polar.add("观众1", [1, 2, 3, 4, 3, 5, 1], radius_data=radius, type='barAngle', is_stack=True)
polar.add("观众2", [2, 4, 6, 1, 2, 3, 1], radius_data=radius, type='barAngle', is_stack=True)
polar.add("观众3", [1, 2, 3, 4, 1, 2, 5], radius_data=radius, type='barAngle', is_stack=True)
polar.show_config()
polar.render()

Here Insert Picture Description

2.6 Dynamic Production - Radar FIG. 1

from pyecharts import Radar  #雷达图1
schema =[ ("喜剧", 6500), ("爱情", 16000), ("恐怖", 30000), ("动漫", 38000), 
         ("动作", 52000), ("冒险", 25000)]
v1 =[[4300, 10000, 28000, 35000, 50000, 19000]]
v2 =[[5000, 14000, 28000, 31000, 42000, 21000]]
radar =Radar('观众偏好情况',title_pos='center',background_color='#00ffff',title_top='90%')
radar.config(schema)
radar.add("观众1", v1, is_splitline=True, is_axisline_show=True)
radar.add("观众2", v2, label_color=["#4e79a7"], is_area_show=False)
radar.show_config()
radar.render()

Here Insert Picture Description

2.7 to create dynamic - Radar 2

from pyecharts import Radar  #雷达图1
schema =[ ("喜剧", 6500), ("爱情", 16000), ("恐怖", 30000), ("动漫", 38000), 
         ("动作", 52000), ("冒险", 25000)]
v1 =[[4300, 10000, 28000, 35000, 50000, 19000]]
v2 =[[5000, 14000, 28000, 31000, 42000, 21000]]
radar =Radar('观众偏好情况',title_pos='center',background_color='#00ffff',title_top='90%')
radar.config(schema,shape='circle') #shape修改雷达图外面的形状
radar.add("观众1", v1, is_splitline=True, is_axisline_show=True)
radar.add("观众2", v2, label_color=["#4e79a7"], is_area_show=False)
radar.show_config()
radar.render()

Here Insert Picture Description

2.8 to create dynamic - Scatter

from pyecharts import Scatter   #散点图
v1 =[25.02,18.73,7.85,7.68,7.35,5.35,3.29,2.23,1.98,1.78,1.65,1.64,1.06,1.06,0.69]
v2 =[5.35,4.42,4.31,3.92,3.29,2.23,4.42,4.31,3.92,3.29,2.23,1.98,1.78,1.65,0.8]
scatter =Scatter("电影类型评分",title_pos='center',background_color='#00ffff',title_top='90%')
scatter.add("爱情", v1, v2)
scatter.add("动作", v1[::-1], v2)
scatter.show_config()
scatter.render()

Here Insert Picture Description

3, end the eggs

        It does not tell a story, I list my visual slogan: either helpful! Either interesting!

        Today, here came to an end - here is Jeruser visual feast column, let you experience a different data analysis, how work gets interesting, please continue to focus on me. Thank you for watching me Jetuser-data

Links: [https://blog.csdn.net/L1542334210]
CSND: L1542334210
Here Insert Picture Description
I wish you all success! Family fun!

Published 29 original articles · won praise 53 · views 30000 +

Guess you like

Origin blog.csdn.net/L1542334210/article/details/102679914