参见连接:https://gallery.pyecharts.org/#/README
https://zhuanlan.zhihu.com/p/37908874
测试代码:
from pyecharts.charts import Bar
from pyecharts import options as opts
# 内置主题类型可查看 pyecharts.globals.ThemeType
from pyecharts.globals import ThemeType
bar = (
Bar(init_opts=opts.InitOpts(theme=ThemeType.WONDERLAND))
.add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"])
.add_yaxis("商家A", [5, 20, 36, 10, 75, 90])
.add_yaxis("商家B", [15, 6, 45, 20, 35, 66])
.set_global_opts(title_opts=opts.TitleOpts(title="主标题", subtitle="副标题"))
)
bar.render('change_theme.html')
查看主题色的种类:
from pyecharts.globals import ThemeType
dir(ThemeTye)
输出:
['BUILTIN_THEMES', 'CHALK', 'DARK', 'ESSOS', 'INFOGRAPHIC', 'LIGHT', 'MACARONS', \
'PURPLE_PASSION', 'ROMA', 'ROMANTIC', 'SHINE', 'VINTAGE', 'WALDEN', 'WESTEROS', \
'WHITE', 'WONDERLAND', '__annotations__', '__class__', '__delattr__', '__dict__', \
'__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', \
'__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__',\
'__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', \
'__sizeof__', '__str__', '__subclasshook__', '__weakref__']
DARK:
ESSOS:
INFOGRAPHIC:
MACARONS:
PURPLE_PASSION:
ROMA:
ROMANTIC:
SHINE:
VINTAGE:
WALDEN:
WESTEROS: