pyecharts 图大小
时间: 2023-11-15 18:10:26 浏览: 39
你可以通过以下代码设置 Pyecharts 图的大小:
```python
from pyecharts import options as opts
from pyecharts.charts import Line
line = Line()
line.add_xaxis(['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'])
line.add_yaxis('A', [10, 20, 30, 40, 50, 60, 70])
line.add_yaxis('B', [20, 30, 10, 40, 60, 70, 30])
line.set_global_opts(
title_opts=opts.TitleOpts(title='Line Chart', subtitle='Example'),
xaxis_opts=opts.AxisOpts(name='Day'),
yaxis_opts=opts.AxisOpts(name='Value'),
# 设置图的大小
graphic_opts=opts.GraphicGroup(
graphic_item=opts.GraphicItem(
left='center', top='middle', width=800, height=500
)
)
)
line.render('line.html')
```
在上面的代码中,`graphic_opts` 参数设置了图的大小,使用 `width` 和 `height` 分别设置宽度和高度。