preface
Bar/bar charts, showing the size of data by the height of the bar/width of the bar. This is a relatively simple kind of graph. Simple and intuitiveCopy the code
code
from pyecharts import Bar
The class example header and the add() header can coexist.
wordcloud = Bar("Main title"."Subtitle",
title_color=xxx,
title_pos=xxx, # Center, left, right
width=1300,
height=620,
background_color='xxx'Add () method add(name, x_axis, y_axis, is_stack=False,
bar_category_gap='20%',
is_convert=Fasle,
mark_point='xxxx',
**kwargs)
# bar.add (
# name -> STR
# x_axis -> list, X-axis data
# y_axis -> list, y axis data
# is_stack -> bool, data stack, the same class axis series configuration of the same stack value can be stacked
# bar_category_gap -> int/ STR, the columnar distance of the category axis, which is next to each other when set to 0 (histogram type),The default is'20%'
# is_convert -->bool whether to swap the xy axis.
# mark_point=['average'],mark_point=['min',' Max ']
from pyecharts import Bar
attr = ["Shirt"."Cardigan"."Chiffon shirt."."Pants"."High heels"."Socks"]
value1 = [5.20.36.10.75.90]
value2 = [10.25.8.60.20.80]
bar = Bar("Sample bar chart data stack",width=1000,height=800,title_color=xxx,title_pos="left")
bar.add("Merchants A", attr, value1, is_stack=True)
bar.add(Merchants "B", attr, value2, is_stack=True)
bar.render()
Copy the code