"Python3 reptiles, data cleaning and visualization of actual combat," the eleventh chapter pyecharts, is based on the 0.2.3 version.
pyecharts has been updated to version 1.5.0, the parameters needed to call the pie has been different.
Install an older version pyecharts too strenuous, so I chose pyecharts using the latest version (2019.09) 1.5.0,
Accordingly, the book draw a pie chart of the code need to change.
amend as below:
. 1 from pyecharts.charts Import Pie # # Note that, Pie were put into Charts 2 Import JSON . 3 F = Open ( " DATAS / pies.json " ) # # test data . 4 Data = the json.load (F) . 5 name = Data [ ' name ' ] . 6 Sales = Data [ ' Sales ' ] . 7 sales_volume = Data [ ' sales_volume ' ] . 8 . 9 PIE = Pie () 10 pie.add (SERIES_NAME = " daily " , . 11 data_pair = [List (Z) for Z in zip (name, sales_volume)], # # iteration in zip objects combined into tuples, and set out with List 12 is Center = [225, 250], # # installation position of the center of the pie chart 13 is RADIUS = [ " 10% " , " 35% " ], # # set the size of the pie 14 # provided rosetype, rose diagram is drawn (FIG Nightingale) otherwise ordinary pie 15 # rADIUS: the percentage of the sector central angle of presentation data, the presentation data size of radius 16 #area: all sectors of the same central angle, only by the size of the radius of the presentation data . 17 rosetype = ' RADIUS ' ) 18 is pie.add (SERIES_NAME = " Sales " , . 19 data_pair = [List (Z) for Z in ZIP (name, Sales )], 20 is Center = [625,250], # # adjusted such that the center position of the two do not overlap pie 21 is RADIUS = [ " 10% " , " 35% " ], 22 is rosetype = ' Area ' ) 23 is 24 pie.render ('D:/rose.html')
reference
The official document: https://pyecharts.org/#/zh-cn/basic_charts?id=pie%ef%bc%9a%e9%a5%bc%e5%9b%be
"Python3 reptiles, washing and visualization actual data" Chapter XI
The official code examples Example: https://github.com/pyecharts/pyecharts/tree/master/example