pyecharts中文手册

目录

概览

如何查看使用的pyecharts版本?

一、5分钟上手案例

1、首先开始来推出你的第一个图表

2、pyecharts所有方法均支持链式调用,等价于下面代码:

配置项

一、总体配置项

官方链接:https://pyecharts.org/#/zh-cn/intro


概览

如何查看使用的pyecharts版本?

import pyecharts

print(pyecharts.__version__)

一、5分钟上手案例

1、首先开始来推出你的第一个图表

from pyecharts.charts import Bar
from pyecharts import options as opts
# 设置图形主题,内置主题类型可查看 pyecharts.globals.ThemeType
from pyecharts.globals import ThemeType

filepath = r'C:\Users\Administrator\Desktop\myEcharts.html'
bar = Bar(init_opts=opts.InitOpts(theme=ThemeType.LIGHT))
bar.add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"])
bar.add_yaxis("商家A", [5, 20, 36, 10, 75, 90])
bar.add_yaxis("商家B", [15, 6, 45, 20, 35, 66])
bar.set_global_opts(title_opts=opts.TitleOpts(title="主标题", subtitle="副标题"))
bar.render(filepath)

2、pyecharts所有方法均支持链式调用,等价于下面代码:

from pyecharts.charts import Bar
from pyecharts import options as opts

filepath = r'C:\Users\Administrator\Desktop\myEcharts1.html'
bar = (
    Bar()
    .add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"])
    .add_yaxis("商家A", [5, 20, 36, 10, 75, 90])
    .set_global_opts(title_opts=opts.TitleOpts(title="主标题", subtitle="副标题"))
    # 或者直接使用字典参数
    # .set_global_opts(title_opts={"text": "主标题", "subtext": "副标题"})
    )

bar.render(filepath)

配置项

一、总体配置项

pyecharts中文手册_第1张图片

pyecharts中文手册_第2张图片

官方链接:https://pyecharts.org/#/zh-cn/intro

你可能感兴趣的:(python,数据可视化)