代码如下:
from pyecharts import options as opts
from pyecharts.charts import Bar
#from pyecharts.faker import Faker#用来生成假数据
c = (
Bar()
.add_xaxis('中','美','日')
.add_yaxis("商家A", (1,2,3), category_gap="80%")
.set_global_opts(title_opts=opts.TitleOpts(title="Bar-单系列柱间距离"))
.render("bar_same_series_gap.html")
)
官方文档代码:
from pyecharts import options as opts
from pyecharts.charts import Bar
from pyecharts.faker import Faker
c = (
Bar()
.add_xaxis(Faker.choose())
.add_yaxis("商家A", Faker.values(), category_gap="80%")
.set_global_opts(title_opts=opts.TitleOpts(title="Bar-单系列柱间距离"))
.render("bar_same_series_gap.html")
)
因为不想用假数据,想用自己的数据,所以用完形填空的方式改了下官方文档的密码。但是报错:TypeError: add_xaxis() takes 2 positional arguments but 4 were given
想知道怎么正确的传入自己想要传的数据。