条形图:Bar()
散点图:Scanner()
涟漪图:EffectScatter()
折线图:Line()
K线图:Kline()
饼图:Pie()
圆环图:Pie()
玫瑰图:Pie()
漏斗图:Funnel()
1、条形图
from pyecharts.charts import *
from pyecharts import options as opts
'''条形图'''
bar = (Bar().add_xaxis(["星期一","星期二","星期三","星期四","星期五","星期六","星期天"])
.add_yaxis("条形图",[123,145,126,187,211,198,175])
.set_global_opts(title_opts=opts.TitleOpts(title="测试")))
bar.render_notebook()
2、散点图
from pyecharts.charts import *
from pyecharts import options as opts
'''散点图'''
bar = (Scatter().add_xaxis(["星期一","星期二","星期三","星期四","星期五","星期六","星期天"])
.add_yaxis("散点图",[123,145,126,187,211,198,175])
.set_global_opts(title_opts=opts.TitleOpts(title="测试")))
bar.render_notebook()
from pyecharts.charts import *
from pyecharts import options as opts
'''涟漪图'''
bar = (EffectScatter().add_xaxis(["星期一","星期二","星期三","星期四","星期五","星期六","星期天"])
.add_yaxis("涟漪图",[123,145,126,187,211,198,175])
.set_global_opts(title_opts=opts.TitleOpts(title="测试")))
bar.render_notebook()
4、折线图
from pyecharts.charts import *
from pyecharts import options as opts
'''折线图'''
bar = (Line().add_xaxis(["星期一","星期二","星期三","星期四","星期五","星期六","星期天"])
.add_yaxis("折线图",[123,145,126,187,211,198,175])
.set_global_opts(title_opts=opts.TitleOpts(title="测试")))
bar.render_notebook()
5、K线图(值为二维数据)
from pyecharts.charts import *
from pyecharts import options as opts
'''K线图'''
bar = (Kline().add_xaxis(["星期一","星期二","星期三","星期四","星期五","星期六","星期天"])
.add_yaxis("K线图",[[12,15,19,25,45],[13,15,41,12,23],[1,2,5,7,8],[12,56,41,13,15],[12,45,85,62,3],[100,12,45,62,31],[1,5,13,4,6]])
.set_global_opts(title_opts=opts.TitleOpts(title="测试")))
bar.render_notebook()
6、饼图
from pyecharts.charts import *
from pyecharts import options as opts
'''饼图'''
L1 = ["星期一","星期二","星期三","星期四","星期五","星期六","星期天"]
num = [123,145,126,187,211,198,175]
C = Pie()
C.add("饼图",[list(z) for z in zip(L1,num)])
C.set_global_opts(title_opts=opts.TitleOpts(title="饼图"))
#C.set_series_opts(label_opts=opts.TitleOpts(formatter="{b}:{c}"))
C.render_notebook()
7、圆环图
from pyecharts.charts import *
from pyecharts import options as opts
'''圆环图'''
L1 = ["星期一","星期二","星期三","星期四","星期五","星期六","星期天"]
num = [123,145,126,187,211,198,175]
C = Pie()
'''radius调节大小'''
C.add("圆环图",[list(z) for z in zip(L1,num)],radius=["45%","75%"])
C.set_global_opts(title_opts=opts.TitleOpts(title="圆环图"),legend_opts=opts.LegendOpts(orient="vertical",pos_top="2%",pos_left="5%"))
C.render_notebook()
8、玫瑰图
from pyecharts.charts import *
from pyecharts import options as opts
'''玫瑰图'''
L1 = ["星期一","星期二","星期三","星期四","星期五","星期六","星期天"]
num = [123,145,126,187,211,198,175]
C = Pie()
C.add("玫瑰图1",[list(z) for z in zip(L1,num)],radius=["55%","75%"],center=[240,200],rosetype='redius')
C.add("玫瑰图2",[list(z) for z in zip(L1,num)],radius=["45%","75%"],center=[640,200],rosetype='area')
C.render_notebook()
9、漏斗图
from pyecharts.charts import *
from pyecharts import options as opts
'''漏斗图'''
L1 = ["星期一","星期二","星期三","星期四","星期五","星期六","星期天"]
num = [123,145,126,187,211,198,175]
C = Funnel()
C.add("漏斗图",[list(z) for z in zip(L1,num)])
C.render_notebook()