from pywebio.output import put_html from pyecharts import options as opts from pyecharts.charts import Boxplot v1 = [ [850, 740, 900, 1070, 930, 850, 950, 980, 980, 880, 1000, 980], [960, 940, 960, 940, 880, 800, 850, 880, 900, 840, 830, 790], ] v2 = [ [890, 810, 810, 820, 800, 770, 760, 740, 750, 760, 910, 920], [890, 840, 780, 810, 760, 810, 790, 810, 820, 850, 870, 870], ] c = Boxplot() c.add_xaxis(["expr1", "expr2"]) c.add_yaxis("A", c.prepare_data(v1)) c.add_yaxis("B", c.prepare_data(v2)) c.set_global_opts(title_opts=opts.TitleOpts(title="BoxPlot-基本示例")) put_html(c.render_notebook())
from pyecharts.charts import Boxplot v1 = [ [850, 740, 900, 1070, 930, 850, 950, 980, 980, 880, 1000, 980], [960, 940, 960, 940, 880, 800, 850, 880, 900, 840, 830, 790], ] v2 = [ [890, 810, 810, 820, 800, 770, 760, 740, 750, 760, 910, 920], [890, 840, 780, 810, 760, 810, 790, 810, 820, 850, 870, 870], ] c = Boxplot() c.add_xaxis(["expr1", "expr2"]) c.add_yaxis("A", c.prepare_data(v1)) c.add_yaxis("B", c.prepare_data(v2)) c.set_global_opts(title_opts=opts.TitleOpts(title="BoxPlot-基本示例")) c.render_notebook() # ## WordCloud # In[156]: # vis import pyecharts.options as opts from pyecharts.charts import WordCloud import jieba.analyse import numpy as np with open('../data/gov_reports1954-2017.txt', 'r') as f: reports = f.readlines()
effect_scatter = EffectScatter() effect_scatter.add_xaxis(Faker.choose()) effect_scatter.add_yaxis("", Faker.values(), symbol=SymbolType.ARROW) effect_scatter.render_notebook() # %% [markdown] # ### Boxplot -- 箱线图 boxplot = Boxplot() boxplot.add_xaxis(Faker.choose()) # 计算数据的最大、最小、中位、四分位数 dt1 = boxplot.prepare_data(list(zip(*[Faker.values() for i in range(20)]))) dt2 = boxplot.prepare_data(list(zip(*[Faker.values() for i in range(20)]))) boxplot.add_yaxis("cat1", dt1) boxplot.add_yaxis("cat2", dt2) boxplot.render_notebook() # %% [markdown] # ### Polar -- 极坐标 import math data=[] # 生成数据,满足格式`[r, \theta]`,即可以认为角度为自变量、径向为因变量 for i in range(0, 360): data.append([100 * math.sin(i/180 * math.pi), i]) polar = Polar() polar.add("", data) # 调整角度坐标轴样式 polar.add_schema( angleaxis_opts=opts.AngleAxisOpts( interval=90,