pyechart设置主题风格
时间: 2023-05-10 21:56:15 浏览: 189
可以使用 pyecharts.globals.ThemeType 来设置主题风格,例如:
from pyecharts.globals import ThemeType
from pyecharts.charts import Bar
bar = Bar()
bar.set_global_opts(title_opts={"text": "柱状图示例", "subtext": "这是副标题"},
toolbox_opts={"feature": {"saveAsImage": {}}},
legend_opts={"orient": "vertical", "pos_left": "right"},
xaxis_opts={"name": "x轴名称", "type": "category", "data": ["苹果", "香蕉", "橙子", "梨子", "葡萄"]},
yaxis_opts={"name": "y轴名称", "type": "value"},
theme=ThemeType.LIGHT) # 设置主题风格为 LIGHT
bar.add_yaxis("水果销量", [50, 30, 80, 60, 90])
bar.render("bar.html") # 生成图表文件