散点图:
from pyecharts.charts import *
import numpy as np
import pyecharts.options as opt
x = np.linspace(0,2*np.pi,50)
y = np.sin(x)
y2 = np.cos(x)
# 散点图
(Scatter(init_opts=opt.InitOpts(width='620px',height='320px'))
.add_xaxis(xaxis_data=x)
.add_yaxis(series_name='sin',y_axis=y)
.add_yaxis(series_name='cos',y_axis=y2,label_opts=opt.LabelOpts(is_show=False))
).render_notebook()
线图:
# 线图
(Line()
.add_xaxis(xaxis_data=x)
.add_yaxis(series_name='sin',y_axis=y,label_opts=opt.LabelOpts(is_show=False))
.set_global_opts(title_opts=opt.TitleOpts(title='曲线'), # 设置标题
tooltip_opts=opt.TooltipOpts(axis_pointer_type='cross')
) # 全局设置,
).render_notebook()
版权声明:本文为x1432553805原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。