用Pyecharts的Calendar画图图片正上方有一个小方格怎么删去
时间: 2024-05-15 16:17:48 浏览: 45
可以通过以下代码去除图片正上方的小方格:
```python
from pyecharts.charts import Calendar
from pyecharts import options as opts
cal = Calendar()
cal.add("日历图", [], [], calendar_opts=opts.CalendarOpts(pos_top="50px"))
cal.set_global_opts(
title_opts=opts.TitleOpts(title="日历图示例"),
graphic_opts=[
opts.GraphicGroup(
graphic_item=opts.GraphicItem(
left="center",
top="50%",
bounding="raw",
children=[
opts.GraphicRect(
graphic_item=opts.GraphicItem(left="center", top="middle"),
graphic_shape_opts=opts.GraphicShapeOpts(width=400, height=50),
graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(fill="#fff"),
)
],
)
)
],
)
cal.render("calendar.html")
```
在上述代码中,通过 `graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(fill="#fff")` 将小方格改为白色从而实现去除小方格的效果。
阅读全文