pyecharts-散点/平行坐标系/桑基图/关系图/矩形树图/主题旭日图

整理自官网

from pyecharts.globals import CurrentConfig, OnlineHostType
CurrentConfig.ONLINE_HOST = OnlineHostType.NOTEBOOK_HOST

散点图-多图

from pyecharts.charts import Scatter,EffectScatter
import numpy as np
y = np.random.randint(1,30,50).tolist()
s = EffectScatter()
s.add_xaxis(xaxis_data=range(50))
s.add_yaxis('A', y_axis=y, symbol='pin',symbol_size=16,label_opts=opts.LabelOpts(is_show=False))
s.set_global_opts(
    title_opts=opts.TitleOpts(title='散点图-涟漪特效散点'),
    xaxis_opts=opts.AxisOpts(name='秒'),
    yaxis_opts=opts.AxisOpts(name='流量'),
    legend_opts=opts.LegendOpts(pos_right=50),
    # series_index指定映射的系列索引
   visualmap_opts=[
       opts.VisualMapOpts(type_='color', min_=0,max_=50,series_index=0, pos_top='20px'),
       opts.VisualMapOpts(type_='size', min_=0,max_=50,series_index=1, pos_top='60%')
   ]
                   
)
s2 = Scatter()
s2.add_xaxis(xaxis_data=range(50))
s2.add_yaxis('B', y_axis=y,
             xaxis_index=1, yaxis_index=1,
             label_opts=opts.LabelOpts(is_show=False))
s2.set_global_opts(
    xaxis_opts=opts.AxisOpts(name='秒', grid_index=1),
    yaxis_opts=opts.AxisOpts(name='流量'),
    legend_opts=opts.LegendOpts(pos_right=10),
)
​
g = Grid(init_opts=opts.InitOpts(height='450px', width='850px'))
g.add(s,grid_opts=opts.GridOpts(height="35%"))  # 高度变为35%
g.add(s2,grid_opts=opts.GridOpts(pos_top='60%',height="35%"))  # 距离容器顶部的距离
g.render_notebook()

在这里插入图片描述

平行坐标系

from pyecharts.charts import Parallel

平行坐标系-基本设置

r = np.random.rand(12)
data = [[i, round(j,2), round(m,2), n] for i,j,m,n in zip(range(12),r,np.random.randint(1,3,12)+r, np.random.choice(['A','B'],12))]
data[:3]

[[0, 0.04, 1.04, ‘A’], [1, 0.9, 1.9, ‘A’], [2, 0.11, 2.11, ‘B’]]

# 坐标轴设置,类别轴设置data所有的类别
schema = [
    {
   'dim':0,'name':'月份'},{
   'dim':1,'name':'指标1'},
    {
   'dim':2
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值