def creat_Scatter(): v1 = [10, 20, 30, 40, 50, 60] v2 = [10, 20, 30, 40, 50, 60] scatter = pyecharts.Scatter("散点图示例") scatter.add("A", v1, v2) scatter.add("B", v1[::-1], v2) page.add(scatter) scatter = pyecharts.Scatter("散点图示例") scatter.add("A", ["a", "b", "c", "d", "e", "f"], v2) scatter.add("B", ["a", "b", "c", "d", "e", "f"], v1[::-1], xaxis_type="category") page.add(scatter)
def ksh_scatter(*data): n = len(data) if "FG" in data: m = 4 lamble = 0 #数据是2D为0,3D为1 if data[m] == "FG": scatter = pyecharts.Scatter(data[0]) scatter.add(data[m - 3], data[m - 2], data[m - 1]) else: scatter = pyecharts.Scatter3D(data[0], width=1200, height=600) scatter.add(data[m - 3], data[m - 2], is_visualmap=True, visual_range_color=range_color) lamble = 1 while m <= n: if lamble == 0: scatter.add(data[m - 3], data[m - 2], data[m - 1]) m = m + 4 else: print(m) scatter.add(data[m], data[m + 1], is_visualmap=True, visual_range_color=range_color) m = m + 3 if n == 4: scatter = pyecharts.Scatter(data[0]) scatter.add(data[1], data[2], data[3]) if n == 3: scatter = pyecharts.Scatter3D(data[0], width=1200, height=600) scatter.add(data[1], data[2], data[3], data[4], is_visualmap=True, visual_range_color=range_color) return scatter
def t20(pa): scatter = p.Scatter('各大公司工资经验') scatter.add('工资', next(pa), next(pa), extra_data=next(pa), is_visualmap=True, visual_dimension=2, xaxis_type="category", visual_range=[0, 6], is_toolbox_show=False) return scatter
def t7(pa): scatter = p.Scatter("学历与需求量、薪水关系") scatter.add("薪水", next(pa), next(pa), extra_data=next(pa), is_visualmap=True, xaxis_type="category", visual_dimension=2, visual_range=[500, 500000], is_toolbox_show=False, visual_top=9999) return scatter
def area_and_prices(self): scatter = pyecharts.Scatter("总价-面积散点图", '统计时间:2018-9-30') scatter.add('🏠总价(单位:万元)', self.data['area'], self.data['price'], is_legend_show=False, visual_pos='right', is_visualmap=True, visual_type="color", visual_range=[100, 1000], mark_point=['max'], xaxis_name='面积', yaxis_name='总价') scatter.render()
def print_scatter(datas): style = pc.Style().add( is_visualmap=True, xaxis_name="平均票价", yaxis_name="场均人次", tooltip_formatter="{c}" ) sc = pc.Scatter('test', 'subtest') datas_amount = datas.amount.values datas_avgPS = datas.avgPS.astype(float).round(1) datas_avgprice = datas.avgprice.astype(float).round(1) sc.add("test", datas_avgprice, datas_avgPS, extra_data=list(datas_amount), **style) sc.render("test.html")
# In[477]: list_calorie bar = ec.Bar(width=1000) calories = ['<0'] calories += [i * 10 for i in (range(20))] calories.append('≥200') bar.add('卡路里', calories, list_calorie) bar # In[16]: sct = ec.Scatter(width=1000, height=600) list_level = [] list_calorie = [] us = User.select() for u in us: list_level.append(u.level) list_calorie.append(max(min(u.calorie, 25000), -5000)) sct.add('用户', list_level, list_calorie, symbol_size=5, xaxis_name='等级', yaxis_name='卡路里') sct # In[490]: us = User.select() sports = {}
[1, -2, 2, 5, 3, 2, 0], mark_point=["max", "min"], mark_line=["average"], legend_top="50%", ) grid = echarts.Grid() grid.add(bar, grid_bottom="60%") grid.add(line, grid_top="60%") grid.render(path='tmp/grid.html') # 左右类型,Scatter + EffectScatter if __name__ == '__main__': v1 = [5, 20, 36, 10, 75, 90] v2 = [10, 25, 8, 60, 20, 80] scatter = echarts.Scatter(width=1200) scatter.add("散点图示例", v1, v2, legend_pos="70%") es = echarts.EffectScatter() es.add( "动态散点图示例", [11, 11, 15, 13, 12, 13, 10], [1, -2, 2, 5, 3, 2, 0], effect_scale=6, legend_pos="20%", ) grid = echarts.Grid() grid.add(scatter, grid_left="60%") grid.add(es, grid_right="60%") grid.render(path='tmp/grid.html')