程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Data visualization Python based data visualization tool suggestions collection

編輯:Python

Hello everyone , I meet you again , I'm your friend, Quan Jun

 Yu Yu Liu , Now a start-up company is in charge of technology , Do crawler and data processing related work , I have been engaged in the research and development of card system 、 Research and development of financial cloud computing service system , Big data research and development in the direction of Internet of things , Write a Book ,《Python3.5 Learn from scratch 》

How to do Python Of data visualization ?

pyecharts Is one used to generate Echarts Class library for diagrams . Echarts Baidu open source is a data visualization JS library . Mainly used for data visualization .

One 、 install

pyecharts compatible Python2 and Python3. The current version is 0.1.4

pip install pyecharts

Two 、 introduction

Let's start with your first chart

frompyecharts importBarbar =Bar(“ My first chart “, “ Here is the subtitle “)bar.add(“ clothing “, [“ shirt “, “ Woolen sweater “, “ Snow spins unlined upper garment “, “ The trousers “, “ High heels “, “ socks “], [5, 20, 36, 10, 75, 90])bar.show_config()bar.render()

Tip: You can press the download button on the right to download the picture to the local

  • add() The main method , Used to add chart data and set various configuration items
  • show_config() Print out all configuration items of the chart
  • render() By default, a... Will be generated in the root directory render.html The file of , Support path Parameters , Set file save location , Such as render(r”e:my_first_chart.html”), File open with browser . The default encoding type is UTF-8, stay Python3 There's nothing wrong with it ,Python3 Support for Chinese is much better . But in Python2 in , Coding is a headache , We haven't found a perfect solution yet , At present, we can only encode by ourselves through the text editor , I use it Visual Studio Code, Through the first Gbk The code is back on , And then use UTF-8 Save again , In this way, if you open it with a browser, there will be no garbled Chinese .

Basically all chart types are drawn like this :

  1. chart_name = Type() Initialize the specific type chart .
  2. add() Add data and configuration items .
  3. render() Generate .html file .

3、 ... and 、 Chart type

Because of the length , Here are only examples of each chart type ( Code + Generate charts ), The purpose is to arouse the interest of readers . Please refer to the project for detailed parameter introduction README.md file

1 Bar( Histogram / Bar chart )

frompyecharts importBarbar =Bar(“ Examples of marker lines and marker points “)bar.add(“ merchants A“, attr, v1, mark_point=[“average“])bar.add(“ merchants B“, attr, v2, mark_line=[“min“, “max“])bar.render()

frompyecharts importBarbar =Bar(“x Axis and y Axis exchange “)bar.add(“ merchants A“, attr, v1)bar.add(“ merchants B“, attr, v2, is_convert=True)bar.render()

2 EffectScatter( Scatter with ripple effect animation )

frompyecharts importEffectScatterv1 =[10, 20, 30, 40, 50, 60]v2 =[25, 20, 15, 10, 60, 33]es =EffectScatter(“ Dynamic scatter diagram example “)es.add(“effectScatter“, v1, v2)es.render()

es =EffectScatter(“ Various graphic examples of dynamic scatter diagram “)es.add(“”, [10], [10], symbol_size=20, effect_scale=3.5, effect_period=3, symbol=“pin“)es.add(“”, [20], [20], symbol_size=12, effect_scale=4.5, effect_period=4,symbol=“rect“)es.add(“”, [30], [30], symbol_size=30, effect_scale=5.5, effect_period=5,symbol=“roundRect“)es.add(“”, [40], [40], symbol_size=10, effect_scale=6.5, effect_brushtype=‘fill‘,symbol=“diamond“)es.add(“”, [50], [50], symbol_size=16, effect_scale=5.5, effect_period=3,symbol=“arrow“)es.add(“”, [60], [60], symbol_size=6, effect_scale=2.5, effect_period=3,symbol=“triangle“)es.render()

3 Funnel( Funnel diagram )

frompyecharts importFunnelattr =[“ shirt “, “ Woolen sweater “, “ Snow spins unlined upper garment “, “ The trousers “, “ High heels “, “ socks “]value =[20, 40, 60, 80, 100, 120]funnel =Funnel(“ Example funnel chart “)funnel.add(“ goods “, attr, value, is_label_show=True, label_pos=“inside“, label_text_color=“#fff“)funnel.render()

4 Gauge( The dashboard )

frompyecharts importGaugegauge =Gauge(“ Example dashboard “)gauge.add(“ Business indicators “, “ Completion rate “, 66.66)gauge.show_config()gauge.render()

5 Geo( Geographic coordinate system )

frompyecharts importGeodata =[ (“ Haimen “, 9),(“ ordos “, 12),(“ Zhaoyuan “, 12),(“ zhoushan “, 12),(“ Qiqihar “, 14),(“ yancheng “, 15), (“ Chifeng “, 16),(“ Qingdao “, 18),(“ Rushan “, 18),(“ Jinchang “, 19),(“ quanzhou “, 21),(“ Laixi “, 21), (“ sunshine “, 21),(“ Jiaonan “, 22),(“ nantong “, 23),(“ Lhasa “, 24),(“ The clouds are floating “, 24),(“ Meizhou “, 25)…]geo =Geo(“ Air quality in major cities of the country “, “data from pm2.5“, title_color=“#fff“, title_pos=“center“,width=1200, height=600, background_color=‘#404a59‘)attr, value =geo.cast(data)geo.add(“”, attr, value, visual_range=[0, 200], visual_text_color=“#fff“, symbol_size=15, is_visualmap=True)geo.show_config()geo.render()

frompyecharts importGeodata =[(“ Haimen “, 9), (“ ordos “, 12), (“ Zhaoyuan “, 12), (“ zhoushan “, 12), (“ Qiqihar “, 14), (“ yancheng “, 15)]geo =Geo(“ Air quality in major cities of the country “, “data from pm2.5“, title_color=“#fff“, title_pos=“center“, width=1200, height=600, background_color=‘#404a59‘)attr, value =geo.cast(data)geo.add(“”, attr, value, type=“effectScatter“, is_random=True, effect_scale=5)geo.show_config()geo.render()

6 Graph( The diagram )

frompyecharts importGraphnodes =[{ “name“: “ node 1“, “symbolSize“: 10}, { “name“: “ node 2“, “symbolSize“: 20}, { “name“: “ node 3“, “symbolSize“: 30}, { “name“: “ node 4“, “symbolSize“: 40}, { “name“: “ node 5“, “symbolSize“: 50}, { “name“: “ node 6“, “symbolSize“: 40}, { “name“: “ node 7“, “symbolSize“: 30}, { “name“: “ node 8“, “symbolSize“: 20}]links =[]fori innodes: forj innodes: links.append({ “source“: i.get(‘name‘), “target“: j.get(‘name‘)})graph =Graph(“ The diagram - An example of a circular layout “)graph.add(“”, nodes, links, is_label_show=True, repulsion=8000, layout=‘circular‘, label_text_color=None)graph.show_config()graph.render()

frompyecharts importGraphimportjsonwithopen(“..jsonweibo.json“, “r“, encoding=“utf-8“) asf: j =json.load(f) nodes, links, categories, cont, mid, userl =jgraph =Graph(“ Microblog forwarding diagram “, width=1200, height=600)graph.add(“”, nodes, links, categories, label_pos=“right“, repulsion=50, is_legend_show=False, line_curve=0.2, label_text_color=None)graph.show_config()graph.render()

7 Line( Broken line / Area map )

frompyecharts importLineattr =[“ shirt “, “ Woolen sweater “, “ Snow spins unlined upper garment “, “ The trousers “, “ High heels “, “ socks “]v1 =[5, 20, 36, 10, 10, 100]v2 =[55, 60, 16, 20, 15, 80]line =Line(“ Example of line chart “)line.add(“ merchants A“, attr, v1, mark_point=[“average“])line.add(“ merchants B“, attr, v2, is_smooth=True, mark_line=[“max“, “average“])line.show_config()line.render()

line =Line(“ Broken line diagram - Example of ladder diagram “)line.add(“ merchants A“, attr, v1, is_step=True, is_label_show=True)line.show_config()line.render()

line =Line(“ Broken line diagram - Area map example “)line.add(“ merchants A“, attr, v1, is_fill=True, line_opacity=0.2, area_opacity=0.4, symbol=None)line.add(“ merchants B“, attr, v2, is_fill=True, area_color=‘#000‘, area_opacity=0.3, is_smooth=True)line.show_config()line.render()

8 Liquid( Water polo )

frompyecharts importLiquidliquid =Liquid(“ Example of water polo diagram “)liquid.add(“Liquid“, [0.6])liquid.show_config()liquid.render()

frompyecharts importLiquidliquid =Liquid(“ Example of water polo diagram “)liquid.add(“Liquid“, [0.6, 0.5, 0.4, 0.3], is_liquid_outline_show=False)liquid.show_config()liquid.render()

frompyecharts importLiquidliquid =Liquid(“ Example of water polo diagram “)liquid.add(“Liquid“, [0.6, 0.5, 0.4, 0.3], is_liquid_animation=False, shape=‘diamond‘)liquid.show_config()liquid.render()

9 Map( Map )

frompyecharts importMapvalue =[155, 10, 66, 78, 33, 80, 190, 53, 49.6]attr =[“ fujian “, “ Shandong “, “ Beijing “, “ Shanghai “, “ gansu “, “ xinjiang “, “ Henan “, “ guangxi “, “ Tibet “]map=Map(“Map combination VisualMap Example “, width=1200, height=600)map.add(“”, attr, value, maptype=‘china‘, is_visualmap=True, visual_text_color=‘#000‘)map.show_config()map.render()

frompyecharts importMapvalue =[20, 190, 253, 77, 65]attr =[‘ Shantou city ‘, ‘ Shanwei cities ‘, ‘ Jieyang city ‘, ‘ yangjiang ‘, ‘ Zhaoqing city ‘]map=Map(“ Guangdong map example “, width=1200, height=600)map.add(“”, attr, value, maptype=‘ guangdong ‘, is_visualmap=True, visual_text_color=‘#000‘)map.show_config()map.render()

10 Parallel( Parallel coordinate system )

frompyecharts importParallelc_schema =[ { “dim“: 0, “name“: “data“}, { “dim“: 1, “name“: “AQI“}, { “dim“: 2, “name“: “PM2.5“}, { “dim“: 3, “name“: “PM10“}, { “dim“: 4, “name“: “CO“}, { “dim“: 5, “name“: “NO2“}, { “dim“: 6, “name“: “CO2“}, { “dim“: 7, “name“: “ Grade “, “type“: “category“, “data“: [‘ optimal ‘, ‘ good ‘, ‘ Light pollution ‘, ‘ Moderate pollution ‘, ‘ Severe pollution ‘, ‘ Serious pollution ‘]}]data =[ [1, 91, 45, 125, 0.82, 34, 23, “ good “], [2, 65, 27, 78, 0.86, 45, 29, “ good “], [3, 83, 60, 84, 1.09, 73, 27, “ good “], [4, 109, 81, 121, 1.28, 68, 51, “ Light pollution “], [5, 106, 77, 114, 1.07, 55, 51, “ Light pollution “], [6, 109, 81, 121, 1.28, 68, 51, “ Light pollution “], [7, 106, 77, 114, 1.07, 55, 51, “ Light pollution “], [8, 89, 65, 78, 0.86, 51, 26, “ good “], [9, 53, 33, 47, 0.64, 50, 17, “ good “], [10, 80, 55, 80, 1.01, 75, 24, “ good “], [11, 117, 81, 124, 1.03, 45, 24, “ Light pollution “], [12, 99, 71, 142, 1.1, 62, 42, “ good “], [13, 95, 69, 130, 1.28, 74, 50, “ good “], [14, 116, 87, 131, 1.47, 84, 40, “ Light pollution “]]parallel =Parallel(“ Parallel coordinate system - User defined indicator “)parallel.config(c_schema=c_schema)parallel.add(“parallel“, data)parallel.show_config()parallel.render()

11 Pie( The pie chart )

frompyecharts importPieattr =[“ shirt “, “ Woolen sweater “, “ Snow spins unlined upper garment “, “ The trousers “, “ High heels “, “ socks “]v1 =[11, 12, 13, 10, 10, 10]pie =Pie(“ Pie chart example “)pie.add(“”, attr, v1, is_label_show=True)pie.show_config()pie.render()

frompyecharts importPieattr =[“ 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]pie =Pie(“ The pie chart - An example of a rose chart “, title_pos=‘center‘, width=900)pie.add(“ goods A“, attr, v1, center=[25, 50], is_random=True, radius=[30, 75], rosetype=‘radius‘)pie.add(“ goods B“, attr, v2, center=[75, 50], is_random=True, radius=[30, 75], rosetype=‘area‘, is_legend_show=False, is_label_show=True)pie.show_config() pie.render()

12 Polar( Polar system )

frompyecharts importPolarradius =[‘ Monday ‘, ‘ Tuesday ‘, ‘ Wednesday ‘, ‘ Thursday ‘, ‘ Friday ‘, ‘ Saturday ‘, ‘ Sunday ‘]polar =Polar(“ Polar system - Stacked histogram example “, width=1200, height=600)polar.add(“A“, [1, 2, 3, 4, 3, 5, 1], radius_data=radius, type=‘barRadius‘, is_stack=True)polar.add(“B“, [2, 4, 6, 1, 2, 3, 1], radius_data=radius, type=‘barRadius‘, is_stack=True)polar.add(“C“, [1, 2, 3, 4, 1, 2, 5], radius_data=radius, type=‘barRadius‘, is_stack=True)polar.show_config()polar.render()

frompyecharts importPolarradius =[‘ Monday ‘, ‘ Tuesday ‘, ‘ Wednesday ‘, ‘ Thursday ‘, ‘ Friday ‘, ‘ Saturday ‘, ‘ Sunday ‘]polar =Polar(“ Polar system - Stacked histogram example “, width=1200, height=600)polar.add(“”, [1, 2, 3, 4, 3, 5, 1], radius_data=radius, type=‘barAngle‘, is_stack=True)polar.add(“”, [2, 4, 6, 1, 2, 3, 1], radius_data=radius, type=‘barAngle‘, is_stack=True)polar.add(“”, [1, 2, 3, 4, 1, 2, 5], radius_data=radius, type=‘barAngle‘, is_stack=True)polar.show_config()polar.render()

13 Radar( Radar map )

frompyecharts importRadarschema =[ (“ sales “, 6500), (“ management “, 16000), (“ information technology “, 30000), (“ Customer service “, 38000), (“ Research and development “, 52000), (“ market “, 25000)]v1 =[[4300, 10000, 28000, 35000, 50000, 19000]]v2 =[[5000, 14000, 28000, 31000, 42000, 21000]]radar =Radar()radar.config(schema)radar.add(“ Budget allocation “, v1, is_splitline=True, is_axisline_show=True)radar.add(“ The actual cost “, v2, label_color=[“#4e79a7“], is_area_show=False)radar.show_config()radar.render()

value_bj =[ [55, 9, 56, 0.46, 18, 6, 1], [25, 11, 21, 0.65, 34, 9, 2], [56, 7, 63, 0.3, 14, 5, 3], [33, 7, 29, 0.33, 16, 6, 4]…]value_sh =[ [91, 45, 125, 0.82, 34, 23, 1], [65, 27, 78, 0.86, 45, 29, 2], [83, 60, 84, 1.09, 73, 27, 3], [109, 81, 121, 1.28, 68, 51, 4]…]c_schema=[{ “name“: “AQI“, “max“: 300, “min“: 5}, { “name“: “PM2.5“, “max“: 250, “min“: 20}, { “name“: “PM10“, “max“: 300, “min“: 5}, { “name“: “CO“, “max“: 5}, { “name“: “NO2“, “max“: 200}, { “name“: “SO2“, “max“: 100}]radar =Radar()radar.config(c_schema=c_schema, shape=‘circle‘)radar.add(“ Beijing “, value_bj, item_color=“#f9713c“, symbol=None)radar.add(“ Shanghai “, value_sh, item_color=“#b3e4a1“, symbol=None)radar.show_config()radar.render()

14 Scatter( Scatter plot )

frompyecharts importScatterv1 =[10, 20, 30, 40, 50, 60]v2 =[10, 20, 30, 40, 50, 60]scatter =Scatter(“ An example of a scatter diagram “)scatter.add(“A“, v1, v2)scatter.add(“B“, v1[::–1], v2)scatter.show_config()scatter.render()

Scatter print Pyecharts typeface .

frompyecharts importScatterscatter =Scatter(“ An example of a scatter diagram “)v1, v2 =scatter.draw(“../images/pyecharts-0.png“)scatter.add(“pyecharts“, v1, v2, is_random=True)scatter.show_config()scatter.render()

15 WordCloud( Clouds of words )

frompyecharts importWordCloudname =[‘Sam S Club‘, ‘Macys‘, ‘Amy Schumer‘, ‘Jurassic World‘, ‘Charter Communications‘, ‘Chick Fil A‘, ‘Planet Fitness‘, ‘Pitch Perfect‘, ‘Express‘, ‘Home‘, ‘Johnny Depp‘, ‘Lena Dunham‘, ‘Lewis Hamilton‘, ‘KXAN‘, ‘Mary Ellen Mark‘, ‘Farrah Abraham‘, ‘Rita Ora‘, ‘Serena Williams‘, ‘NCAA baseball tournament‘, ‘Point Break‘]value =[10000, 6181, 4386, 4055, 2467, 2244, 1898, 1484, 1112, 965, 847, 582, 555, 550, 462, 366, 360, 282, 273, 265]wordcloud =WordCloud(width=1300, height=620)wordcloud.add(“”, name, value, word_size_range=[20, 100])wordcloud.show_config()wordcloud.render()

wordcloud =WordCloud(width=1300, height=620)wordcloud.add(“”, name, value, word_size_range=[30, 100], shape=‘diamond‘)wordcloud.show_config()wordcloud.render()

5、 ... and 、 User customization

Users can also customize the combination Line/Bar Chart

Need to use get_series() and custom() Method

get_series()“”” Get the series data “””

custom(series)”’ Add custom chart type ”’

  • series -> dict Append chart type series data

First use get_series() get data , Reuse custom() Combine charts

frompyecharts importBar, Lineattr =[‘A‘, ‘B‘, ‘C‘, ‘D‘, ‘E‘, ‘F‘]v1 =[10, 20, 30, 40, 50, 60]v2 =[15, 25, 35, 45, 55, 65]v3 =[38, 28, 58, 48, 78, 68]bar =Bar(“Line – Bar Example “)bar.add(“bar“, attr, v1)line =Line()line.add(“line“, v2, v3)bar.custom(line.get_series())bar.show_config()bar.render()

6、 ... and 、 More examples

Draw a love in polar coordinates

importmathfrompyecharts importPolardata =[]fori inrange(101): theta =i /100*360r =5*(1+math.sin(theta /180*math.pi)) data.append([r, theta])hour =[i fori inrange(1, 25)]polar =Polar(“ Example of polar coordinate system “, width=1200, height=600)polar.add(“Love“, data, angle_data=hour, boundary_gap=False,start_angle=0)polar.show_config()polar.render()

Draw a little flower in polar coordinates

importmathfrompyecharts importPolardata =[]fori inrange(361): t =i /180*math.pi r =math.sin(2*t) *math.cos(2*t) data.append([r, i])polar =Polar(“ Example of polar coordinate system “, width=1200, height=600)polar.add(“Flower“, data, start_angle=0, symbol=None, axis_range=[0, None])polar.show_config()polar.render()

You can also color the flowers

importmathfrompyecharts importPolardata =[]fori inrange(361): t =i /180*math.pi r =math.sin(2*t) *math.cos(2*t) data.append([r, i])polar =Polar(“ Example of polar coordinate system “, width=1200, height=600)polar.add(“Color-Flower“, data, start_angle=0, symbol=None, axis_range=[0, None], area_color=“#f71f24“, area_opacity=0.6)polar.show_config()polar.render()

Draw a love with scattered pictures

frompyecharts importScatterscatter =Scatter(“ An example of a scatter diagram “, width=800, height=480)v1 ,v2 =scatter.draw(“../images/love.png“)scatter.add(“Love“, v1, v2)scatter.render()

Draw a hot picture with scattered dots Bra

frompyecharts importScatterscatter =Scatter(“ An example of a scatter diagram “, width=1000, height=480)v1 ,v2 =scatter.draw(“../images/cup.png“)scatter.add(“Cup“, v1, v2)scatter.render()

Broken line chart of the lowest and highest temperature in a place

frompyecharts importLineattr =[‘ Monday ‘, ‘ Tuesday ‘, ‘ Wednesday ‘, ‘ Thursday ‘, ‘ Friday ‘, ‘ Saturday ‘, ‘ Sunday ‘, ]line =Line(“ Example of line chart “)line.add(“ The highest temperature “, attr, [11, 11, 15, 13, 12, 13, 10], mark_point=[“max“, “min“], mark_line=[“average“])line.add(“ Minimum temperature “, attr, [1, –2, 2, 5, 3, 2, 0], mark_point=[“max“, “min“], mark_line=[“average“], yaxis_formatter=“°C“)line.show_config()line.render()

Pie chart nesting

frompyecharts importPiepie =Pie(“ Pie chart example “, title_pos=‘center‘, width=1000, height=600)pie.add(“”, [‘A‘, ‘B‘, ‘C‘, ‘D‘, ‘E‘, ‘F‘], [335, 321, 234, 135, 251, 148], radius=[40, 55],is_label_show=True)pie.add(“”, [‘H‘, ‘I‘, ‘J‘], [335, 679, 204], radius=[0, 30], legend_orient=‘vertical‘, legend_pos=‘left‘)pie.show_config()pie.render()

The pie chart is nested again

importrandomfrompyecharts importPieattr =[‘A‘, ‘B‘, ‘C‘, ‘D‘, ‘E‘, ‘F‘]pie =Pie(“ Pie chart example “, width=1000, height=600)pie.add(“”, attr, [random.randint(0, 100) for_ inrange(6)], radius=[50, 55], center=[25, 50],is_random=True)pie.add(“”, attr, [random.randint(20, 100) for_ inrange(6)], radius=[0, 45], center=[25, 50],rosetype=‘area‘)pie.add(“”, attr, [random.randint(0, 100) for_ inrange(6)], radius=[50, 55], center=[65, 50],is_random=True)pie.add(“”, attr, [random.randint(20, 100) for_ inrange(6)], radius=[0, 45], center=[65, 50],rosetype=‘radius‘)pie.show_config()pie.render()

Histogram of precipitation and evaporation in a place

frompyecharts importBarattr =[“{} month “.format(i) fori inrange(1, 13)]v1 =[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]v2 =[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]bar =Bar(“ Example histogram “)bar.add(“ Evaporation capacity “, attr, v1, mark_line=[“average“], mark_point=[“max“, “min“])bar.add(“ precipitation “, attr, v2, mark_line=[“average“], mark_point=[“max“, “min“])bar.show_config()bar.render()

In all kinds of movies ” Good movie ” Proportion

frompyecharts importPiepie =Pie(‘ In all kinds of movies ” Good movie ” Proportion ‘, “ The data comes from Douban “, title_pos=‘center‘)pie.add(“”, [“ The plot “, “”], [25, 75], center=[10, 30], radius=[18, 24], label_pos=‘center‘, is_label_show=True, label_text_color=None, )pie.add(“”, [“ fantasy “, “”], [24, 76], center=[30, 30], radius=[18, 24], label_pos=‘center‘, is_label_show=True, label_text_color=None, legend_pos=‘left‘)pie.add(“”, [“ love “, “”], [14, 86], center=[50, 30], radius=[18, 24], label_pos=‘center‘, is_label_show=True, label_text_color=None)pie.add(“”, [“ Thriller “, “”], [11, 89], center=[70, 30], radius=[18, 24], label_pos=‘center‘, is_label_show=True, label_text_color=None)pie.add(“”, [“ adventure “, “”], [27, 73], center=[90, 30], radius=[18, 24], label_pos=‘center‘, is_label_show=True, label_text_color=None)pie.add(“”, [“ action “, “”], [15, 85], center=[10, 70], radius=[18, 24], label_pos=‘center‘, is_label_show=True, label_text_color=None)pie.add(“”, [“ comedy “, “”], [54, 46], center=[30, 70], radius=[18, 24], label_pos=‘center‘, is_label_show=True, label_text_color=None)pie.add(“”, [“ Science fiction “, “”], [26, 74], center=[50, 70], radius=[18, 24], label_pos=‘center‘, is_label_show=True, label_text_color=None)pie.add(“”, [“ The suspense “, “”], [25, 75], center=[70, 70], radius=[18, 24], label_pos=‘center‘, is_label_show=True, label_text_color=None)pie.add(“”, [“ crime “, “”], [28, 72], center=[90, 70], radius=[18, 24], label_pos=‘center‘, is_label_show=True, label_text_color=None, is_legend_show=True, legend_top=“center“)pie.show_config()pie.render()

Draw a snail shell in polar coordinates

importmathfrompyecharts importPolardata =[]fori inrange(5): forj inrange(101): theta =j /100*360alpha =i *360+theta r =math.pow(math.e, 0.003*alpha) data.append([r, theta])polar =Polar(“ Example of polar coordinate system “)polar.add(“”, data, symbol_size=0, symbol=‘circle‘, start_angle=-25, is_radiusaxis_show=False, area_color=“#f3c5b3“, area_opacity=0.5, is_angleaxis_show=False)polar.show_config()polar.render()

Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/150614.html Link to the original text :https://javaforall.cn


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved