def test_polar_type_scatter_more(): data_1 = [(10, random.randint(1, 100)) for i in range(300)] data_2 = [(11, random.randint(1, 100)) for i in range(300)] polar = Polar("极坐标系-散点图示例", width=1200, height=600) polar.add("", data_1, type='scatter') polar.add("", data_2, type='scatter') polar.render()
def test_polar_type_scatter_more(): data_1 = [(10, random.randint(1, 100)) for i in range(300)] data_2 = [(11, random.randint(1, 100)) for i in range(300)] polar = Polar("极坐标系-散点图示例", width=1200, height=600) polar.add("", data_1, type="scatter") polar.add("", data_2, type="scatter") polar.render()
def test_polar_type_barangle(): polar = Polar("极坐标系-堆叠柱状图示例", width=1200, height=600) polar.add("", [1, 2, 3, 4, 3, 5, 1], radius_data=WEEK, type='barAngle', is_stack=True) polar.add("", [2, 4, 6, 1, 2, 3, 1], radius_data=WEEK, type='barAngle', is_stack=True) polar.add("", [1, 2, 3, 4, 1, 2, 5], radius_data=WEEK, type='barAngle', is_stack=True) polar.render()
def test_polar_draw_flower(): data = [] for i in range(361): t = i / 180 * math.pi r = math.sin(2 * t) * math.cos(2 * t) data.append([r, i]) polar = Polar("极坐标系示例", width=1200, height=600) polar.add("Flower", data, start_angle=0, symbol=None, axis_range=[0, None]) polar.render()
def hot_dog_polar_lzx(): polar_lzx = Polar('各年度热狗大胃王比赛前三名成绩-李兆旭', height=600) with open('../data/hot-dog-places.csv') as f: data_lzx = list(csv.reader(f)) style_lzx = dict(type='barAngle', legend_orient='vertical', legend_pos='right') polar_lzx.add("First", angle_data=data_lzx[0], data=data_lzx[1], is_stack=True, **style_lzx) polar_lzx.add("Second", angle_data=data_lzx[0], data=data_lzx[2], is_stack=True, **style_lzx) polar_lzx.add("Third", angle_data=data_lzx[0], data=data_lzx[3], is_stack=True, **style_lzx) polar_lzx.render('hot-dog-polar.html')
def jizuobiao_duidiezhuzhuang(): '''极坐标-堆叠柱状图''' radius = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] polar = Polar("极坐标系-堆叠柱状图示例", 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.render('./info/极坐标-堆叠柱状图.html')
def jizuobiao_huitu(): '''极坐标-绘制花朵''' data = [] for i in range(361): t = i / 180 * math.pi r = math.sin(2 * t) * math.cos(2 * t) data.append([r, i]) polar = Polar("极坐标系示例", width=1200, height=600) polar.add("Flower", data, start_angle=0, symbol=None, axis_range=[0, None], area_color="#f71f24", area_opacity=0.6) polar.render('./info/极坐标-绘制花朵.html')
def test_polar_draw_love(): data = [] for i in range(101): theta = i / 100 * 360 r = 5 * (1 + math.sin(theta / 180 * math.pi)) data.append([r, theta]) hour = [i for i in range(1, 25)] polar = Polar("极坐标系示例", width=1200, height=600) polar.add("Love", data, angle_data=hour, boundary_gap=False, start_angle=0) polar.render()
def test_polar_draw_color_flower(): data = [] for i in range(361): t = i / 180 * math.pi r = math.sin(2 * t) * math.cos(2 * t) data.append([r, i]) polar = Polar("极坐标系示例", 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.render()
def test_polar_draw_snail(): data = [] for i in range(5): for j in range(101): theta = j / 100 * 360 alpha = i * 360 + theta r = math.pow(math.e, 0.003 * alpha) data.append([r, theta]) polar = Polar("极坐标系示例") 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.render()
def render_polar(): data = [] polar = Polar("polar test") polar.add( "", data, symbol_size=0, symbol="circle", area_color="#f3c5b3", type="custom", render_item=custom_polar_render_item, area_opacity=0.5, is_angleaxis_show=False, ) polar.render()
def test_polar_draw(): # draw love import math data = [] for i in range(101): theta = i / 100 * 360 r = 5 * (1 + math.sin(theta / 180 * math.pi)) data.append([r, theta]) hour = [i for i in range(1, 25)] polar = Polar("极坐标系示例", width=1200, height=600) polar.add("Love", data, angle_data=hour, boundary_gap=False, start_angle=0) polar.render() # draw flower data = [] for i in range(361): t = i / 180 * math.pi r = math.sin(2 * t) * math.cos(2 * t) data.append([r, i]) polar = Polar("极坐标系示例", width=1200, height=600) polar.add("Flower", data, start_angle=0, symbol=None, axis_range=[0, None]) polar.render() # draw color flower data = [] for i in range(361): t = i / 180 * math.pi r = math.sin(2 * t) * math.cos(2 * t) data.append([r, i]) polar = Polar("极坐标系示例", 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.render() # draw snail data = [] for i in range(5): for j in range(101): theta = j / 100 * 360 alpha = i * 360 + theta r = math.pow(math.e, 0.003 * alpha) data.append([r, theta]) polar = Polar("极坐标系示例") 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.render()
def jizuobiao_huitu2(): '''极坐标绘制蜗牛''' data = [] for i in range(5): for j in range(101): theta = j / 100 * 360 alpha = i * 360 + theta # e = 2.718281828459045 r = math.pow(math.e, 0.003 * alpha) data.append([r, theta]) polar = Polar("极坐标系示例") 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.render('./info/极坐标-蜗牛.html')
def heatmap_polar(df, value, attr1, attr2): polar = Polar("自定义渲染逻辑示例", width=1200, height=600) polar.add( "", [ [ list(set(df[attr1])).index(df[attr1][i]), list(set(df[attr2])).index(df[attr2][i]), df[value][i], ] for i in range(df.shape[0]) ], render_item=render_item, type="custom", angle_data=list(set(df[attr1])), radius_data=list(set(df[attr2])), is_visualmap=True, visual_range=[0, max(df[value])] ) polar.render()
def generate_kfc_dks_distribute_polar_bar_chart(): # 读取数据 data = pd.read_excel(input_file_path + '省会城市KFC_MC_德克士.xlsx', sheet_name=0) print(data.head()) city = data['城市'].tolist() mc_num = data['麦当劳店面数量'].tolist() kfc_num = data['KFC店面数量'].tolist() dks_num = data['德克士店面数量'].tolist() radius = city # polar = Polar('省会城市快餐店数量', width=1200, height=600) # polar.add('', mc_num, radius_data=radius, type='barAngle', is_stack=True) # polar.add('', kfc_num, radius_data=radius, type='barAngle', is_stack=True) # polar.add('', dks_num, radius_data=radius, type='barAngle', is_stack=True) # polar.render(output_file_path + 'htmls/省会城市快餐店数量极坐标堆叠柱状图.html') polar = Polar('省会城市快餐店数量', width=1200, height=1200) polar.add('', mc_num, radius_data=radius, type='barRadius', is_stack=True) polar.add('', kfc_num, radius_data=radius, type='barRadius', is_stack=True) polar.add('', dks_num, radius_data=radius, type='barRadius', is_stack=True) polar.render(output_file_path + 'htmls/省会城市快餐店数量极坐标分类堆叠柱状图.html')
def test_polar(): # polar type 'scatter' import random data = [(i, random.randint(1, 100)) for i in range(101)] polar = Polar("极坐标系-散点图示例") polar.add("", data, boundary_gap=False, type='scatter', is_splitline_show=False, is_axisline_show=True) assert '"type": "scatter"' in polar._repr_html_() # polar type 'scatter' data_1 = [(10, random.randint(1, 100)) for i in range(300)] data_2 = [(11, random.randint(1, 100)) for i in range(300)] polar = Polar("极坐标系-散点图示例", width=1200, height=600) polar.add("", data_1, type='scatter') polar.add("", data_2, type='scatter') polar.render() # polar type 'effectScatter' data = [(i, random.randint(1, 100)) for i in range(10)] polar = Polar("极坐标系-动态散点图示例", width=1200, height=600) polar.add("", data, type='effectScatter', effect_scale=10, effect_period=5) assert '"type": "effectScatter"' in polar._repr_html_() # polar type 'barRadius' radius = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] polar = Polar("极坐标系-堆叠柱状图示例", 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.render() # polar type 'barAngle' radius = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] polar = Polar("极坐标系-堆叠柱状图示例", 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.render()
def test_polar_type_barradius(): polar = Polar("极坐标系-堆叠柱状图示例", width=1200, height=600) polar.add( "A", [1, 2, 3, 4, 3, 5, 1], radius_data=WEEK, type="barRadius", is_stack=True, ) polar.add( "B", [2, 4, 6, 1, 2, 3, 1], radius_data=WEEK, type="barRadius", is_stack=True, ) polar.add( "C", [1, 2, 3, 4, 1, 2, 5], radius_data=WEEK, type="barRadius", is_stack=True, ) polar.render()
from pyecharts import Polar radius = ["周一", "周二", '周三', '周四', '周五'] polar = Polar("极坐标系堆叠图实例") #环状累加 # polar.add("A",[1,2,3,4,1],radius_data=radius,type='barRadius',is_stack=True) # polar.add("B",[2,4,3,1,2],radius_data=radius,type='barRadius',is_stack=True) # polar.add("C",[1,4,2,3,4],radius_data=radius,type='barRadius',is_stack=True) #柱状 polar.add("A", [1, 2, 3, 4, 3], radius_data=radius, type='barAngle', is_stack=True) polar.add("B", [2, 4, 6, 1, 2], radius_data=radius, type='barAngle', is_stack=True) polar.add("C", [1, 2, 3, 4, 1], radius_data=radius, type='barAngle', is_stack=True) polar.render(r'C:\Users\Administrator\Desktop\数据可视化\pyecharts\html\19.html')
from pyecharts import Polar import random ''' 极坐标 示例 ''' polar = Polar("极坐标系-散点图示例") # data = [(i,random.randint(1,100)) for i in range(101)] # polar.add("",data,boundary_gap=False,type='scatter',is_angleaxis_show=True, # area_color="#f23",is_splitline_show=False) radius = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] 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.render(path="Polar2.html")
def test_polar(): # polar_0 import random data = [(i, random.randint(1, 100)) for i in range(101)] polar = Polar("极坐标系-散点图示例") polar.add("", data, boundary_gap=False, type='scatter', is_splitline_show=False, is_axisline_show=True) polar.show_config() polar.render() # polar_1 data_1 = [(10, random.randint(1, 100)) for i in range(300)] data_2 = [(11, random.randint(1, 100)) for i in range(300)] polar = Polar("极坐标系-散点图示例", width=1200, height=600) polar.add("", data_1, type='scatter') polar.add("", data_2, type='scatter') polar.show_config() polar.render() # porlar_2 data = [(i, random.randint(1, 100)) for i in range(10)] polar = Polar("极坐标系-动态散点图示例", width=1200, height=600) polar.add("", data, type='effectScatter', effect_scale=10, effect_period=5) polar.show_config() polar.render() # polar_3 radius = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] polar = Polar("极坐标系-堆叠柱状图示例", 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() # polar_4 radius = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] polar = Polar("极坐标系-堆叠柱状图示例", 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() # polar_5 import math data = [] for i in range(101): theta = i / 100 * 360 r = 5 * (1 + math.sin(theta / 180 * math.pi)) data.append([r, theta]) hour = [i for i in range(1, 25)] polar = Polar("极坐标系示例", width=1200, height=600) polar.add("Love", data, angle_data=hour, boundary_gap=False, start_angle=0) polar.show_config() polar.render() # polar_6 data = [] for i in range(361): t = i / 180 * math.pi r = math.sin(2 * t) * math.cos(2 * t) data.append([r, i]) polar = Polar("极坐标系示例", width=1200, height=600) polar.add("Flower", data, start_angle=0, symbol=None, axis_range=[0, None]) polar.show_config() polar.render() # polar_7 data = [] for i in range(361): t = i / 180 * math.pi r = math.sin(2 * t) * math.cos(2 * t) data.append([r, i]) polar = Polar("极坐标系示例", 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() # polar_8 data = [] for i in range(5): for j in range(101): theta = j / 100 * 360 alpha = i * 360 + theta r = math.pow(math.e, 0.003 * alpha) data.append([r, theta]) polar = Polar("极坐标系示例") 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()
def Year_level(request): consume_level2011 = Consum_level.objects.get(id=17) consume_level2012 = Consum_level.objects.get(id=18) consume_level2013 = Consum_level.objects.get(id=19) consume_level2014 = Consum_level.objects.get(id=20) consume_level2015 = Consum_level.objects.get(id=21) consume_level2016 = Consum_level.objects.get(id=22) consume_level2017 = Consum_level.objects.get(id=23) print(consume_level2017.town_people) radius = ['2011', '2012', '2013', '2014', '2015', '2016', '2017'] polar = Polar("各年份居民消费水平对比图", width=1500, height=600) t1 = int(consume_level2011.town_people) t2 = int(consume_level2012.town_people) t3 = int(consume_level2013.town_people) t4 = int(consume_level2014.town_people) t5 = int(consume_level2015.town_people) t6 = int(consume_level2016.town_people) t7 = int(consume_level2017.town_people) c1 = int(consume_level2011.countryside_people) c2 = int(consume_level2012.countryside_people) c3 = int(consume_level2013.countryside_people) c4 = int(consume_level2014.countryside_people) c5 = int(consume_level2015.countryside_people) c6 = int(consume_level2016.countryside_people) c7 = int(consume_level2017.countryside_people) b1 = float(consume_level2011.balance) b2 = float(consume_level2012.balance) b3 = float(consume_level2013.balance) b4 = float(consume_level2014.balance) b5 = float(consume_level2015.balance) b6 = float(consume_level2016.balance) b7 = float(consume_level2017.balance) polar.add( "城市居民", [t1, t2, t3, t4, t5, t6, t7], radius_data=radius, type="barRadius", is_stack=True, ) polar.add( "农村居民", [c1, c2, c3, c4, c5, c6, c7], radius_data=radius, type="barRadius", is_stack=True, ) polar.add( "城市农村消费水平对比(农村=1)", [b1, b2, b3, b4, b5, b6, b7], radius_data=radius, type="barRadius", is_stack=True, ) polar.render(path="F:/尚世康资料/尚世康+毕业论文相关资料/系统设计/cms/templates/各年份城市农村.html") return HttpResponse("各年份城市农村居民消费水平图生成成功")
# attr = ['太原市','运城市','临汾市','大同市'] # map = Map('山西地图示例',width = 1200,height = 600) # map.add('',attr,value,maptype = '山西', # is_visualmap = True, # visual_text_color = '#000', # is_label_show = True # ) # map.render('./map02.html') # from pyecharts import Line,EffectScatter,Overlap # attr = ['衬衫','羊毛衫','雪纺衫','裤子','高跟鞋','袜子'] # v1 = [5,20,36,10,10,90] # line = Line('线性_闪烁图示例') # line.add('',attr,v1,is_random = True) # # es = EffectScatter() # es.add('',attr,v1,effect_scale=8) #闪烁 # overlop = Overlap() # overlop.add(line) #必须先添加line,在添加es # overlop.add(es) # overlop.render('G://rayfire/html/line-es01.html') from pyecharts import Polar radius =['周一', '周二', '周三', '周四', '周五', '周六', '周日'] polar =Polar("极坐标系-堆叠柱状图示例", width=1200, height=600) polar.add("A", [50, 22, 37, 41, 53, 25, 12], radius_data=radius, type='barRadius', is_stack=True) polar.add("B", [32, 24, 36, 71, 22, 53, 41], radius_data=radius, type='barRadius', is_stack=True) polar.add("C", [45, 32, 33, 54, 21, 32, 45], radius_data=radius, type='barRadius', is_stack=True) polar.show_config() polar.render('G://rayfire/html/polar01.html')
def test_polar(): # polar_0 import random data = [(i, random.randint(1, 100)) for i in range(101)] polar = Polar("极坐标系-散点图示例") polar.add("", data, boundary_gap=False, type='scatter', is_splitline_show=False, is_axisline_show=True) polar.render() # polar_1 data_1 = [(10, random.randint(1, 100)) for i in range(300)] data_2 = [(11, random.randint(1, 100)) for i in range(300)] polar = Polar("极坐标系-散点图示例", width=1200, height=600) polar.add("", data_1, type='scatter') polar.add("", data_2, type='scatter') polar.render() # porlar_2 data = [(i, random.randint(1, 100)) for i in range(10)] polar = Polar("极坐标系-动态散点图示例", width=1200, height=600) polar.add("", data, type='effectScatter', effect_scale=10, effect_period=5) polar.render() # polar_3 radius = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] polar = Polar("极坐标系-堆叠柱状图示例", 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.render() # polar_4 radius = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] polar = Polar("极坐标系-堆叠柱状图示例", 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.render() # polar_5 import math data = [] for i in range(101): theta = i / 100 * 360 r = 5 * (1 + math.sin(theta / 180 * math.pi)) data.append([r, theta]) hour = [i for i in range(1, 25)] polar = Polar("极坐标系示例", width=1200, height=600) polar.add("Love", data, angle_data=hour, boundary_gap=False, start_angle=0) polar.render() # polar_6 data = [] for i in range(361): t = i / 180 * math.pi r = math.sin(2 * t) * math.cos(2 * t) data.append([r, i]) polar = Polar("极坐标系示例", width=1200, height=600) polar.add("Flower", data, start_angle=0, symbol=None, axis_range=[0, None]) polar.render() # polar_7 data = [] for i in range(361): t = i / 180 * math.pi r = math.sin(2 * t) * math.cos(2 * t) data.append([r, i]) polar = Polar("极坐标系示例", 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.render() # polar_8 data = [] for i in range(5): for j in range(101): theta = j / 100 * 360 alpha = i * 360 + theta r = math.pow(math.e, 0.003 * alpha) data.append([r, theta]) polar = Polar("极坐标系示例") 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.render()
from pyecharts import Polar angle = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] polar = Polar("极坐标系-堆叠柱状图示例", width=1200, height=600) polar.add( "", [1, 2, 3, 4, 3, 5, 1], angle_data=angle, type="barAngle", is_stack=True, ) polar.add( "", [2, 4, 6, 1, 2, 3, 1], angle_data=angle, type="barAngle", is_stack=True, ) polar.add( "", [1, 2, 3, 4, 1, 2, 5], angle_data=angle, type="barAngle", is_stack=True, ) polar.render('1.html')
# -*- coding: utf-8 -*- """ Created on Fri Aug 11 10:07:15 2017 @author: 17549 """ from pyecharts import Polar radius=['周一','周二','周三','周四','周五','周六','周日'] polar=Polar("极坐标-堆叠柱状图",width=1200,height=600) polar.add("A",[1,2,3,4,3,5,1],radius_data=radius,type='barAngle',is_stack=True) polar.add("B",[2,4,6,1,2,3,1],radius_data=radius,type='barAngle',is_stack=True) polar.add("C",[1,2,3,4,1,2,5],radius_data=radius,type='barAngle',is_stack=True) polar.show_config() polar.render(r"E:\16_极坐标-堆叠柱状图.html")
) polar.add( "下降", list(xia), angle_data=angle, type="barAngle", is_stack=True, ) polar.add( "持平", list(zhong), angle_data=angle, type="barAngle", is_stack=True, ) polar.render("波动总体情况.html") '''星座-波动数量热力图''' #%% ############转移############# from pyecharts import GeoLines, Style style = Style(title_top="#fff", title_pos="center", title_color="#FFFFFF", width=1600, height=1000, background_color="#646464") style_geo = style.add(is_label_show=True, line_curve=0.2, line_opacity=1, legend_text_color="#eee",
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> # Part 7 Create Polar Coordinates with Pyecharts >>> from pyecharts import Polar >>> radius=['Mon','Tus','Wen','Thu','Fri','Sat','Sun'] >>> polar=Polar("Polar Coordinate",width=1200,height=600) >>> polar.add("XC90",[100,200,300,200,400,500],radius_data=radius,type="barRadius",is_stack=True) <pyecharts.charts.polar.Polar object at 0x0366D5B0> >>> polar.add("XC60",[200,100,400,150,300,600],radius_data=radius,type="barRadius",is_stack=True) <pyecharts.charts.polar.Polar object at 0x0366D5B0> >>> polar.add("S60",[150,50,300,250,200,500],radius_data=radius,type="barRadius",is_stack=True) <pyecharts.charts.polar.Polar object at 0x0366D5B0> >>> polar.add("S90",[120,180,200,350,400,1000],radius_data=radius,type="barRadius",is_stack=True) <pyecharts.charts.polar.Polar object at 0x0366D5B0> >>> polar.add("xc40",[250,280,100,150,600,1200],radius_data=radius,type="barRadius",is_stack=True) <pyecharts.charts.polar.Polar object at 0x0366D5B0> >>> polar.add("V40",[50,80,200,150,60,120],radius_data=radius,type="barRadius",is_stack=True) <pyecharts.charts.polar.Polar object at 0x0366D5B0> >>> polar.add("V60",[130,180,260,150,360,700],radius_data=radius,type="barRadius",is_stack=True) <pyecharts.charts.polar.Polar object at 0x0366D5B0> >>> polar.add("PoleStar1",[50,80,20,150,160,220],radius_data=radius,type="barRadius",is_stack=True) <pyecharts.charts.polar.Polar object at 0x0366D5B0> >>> polar.render() >>>
from pyecharts import Polar radius = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] polar = Polar("极坐标系-堆叠柱状图示例", 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()
# -*- coding: utf-8 -*- """ Created on Fri Aug 11 08:46:09 2017 @author: 17549 """ from pyecharts import Polar import random data = [(i, random.randint(1, 100)) for i in range(101)] polar = Polar("极坐标散点图") polar.add("", data, boundary_gap=False, type='scatter', is_splitline_show=False, area_color=None, is_axisline_show=True) polar.show_config() polar.render(r"E:\14_极坐标散点图.html")
radius = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] polar = Polar("极坐标系-堆叠柱状图示例", 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(path='./data/03-04极坐标.html') # 雷达图 schema = [("销售", 6500), ("管理", 16000), ("信息技术", 30000), ("客服", 38000), ("研发", 52000), ("市场", 25000)] v1 = [[4300, 10000, 28000, 35000, 50000, 19000]] v2 = [[5000, 14000, 28000, 31000, 42000, 21000]] radar = Radar() radar.config(schema) radar.add("预算分配", v1, is_splitline=True, is_axisline_show=True) radar.add("实际开销", v2, label_color=["#4e79a7"], is_area_show=False) radar.show_config() radar.render(path='./data/03-05雷达图.html') """ #支持保持成各种格式,但是会有问题 bar = Bar("我的第一个图表", "这里是副标题")
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from pyecharts import Polar data = pd.read_csv( r'E:\vscode_code\GitHub项目\interesting_python\长安十二时辰\Changan.csv') #print(data['content'].head()) # createTime字段 data['bj_time'] = pd.to_datetime(data['createTime'].values, unit='ms', utc=True).tz_convert('Asia/Shanghai') data['emoji'] = data['content'].str.extract("\[(.*?)\]") #print(data['emoji'].head()) #value_counts是一种查看表格某列中有多少个不同值的快捷方法,并计算每个不同值有在该列中个数 emoji = data['emoji'].value_counts()[:15] #极坐标图 polar = Polar(" ", width=1200, height=600) polar.add( "", emoji.values, angle_data=emoji.index, type="barAngle", is_stack=True, ) polar.render(r'E:\vscode_code\GitHub项目\interesting_python\长安十二时辰\情感分析.html')