The source code is as follows:
The from pyecharts. Charts import Bar, the Line
The from pyecharts import options as opts
Fushi=[" shirt "and" sweater ", "tie", "pants", "trench coat", "high heels", "socks"]
A=[55, 114, 27, 101, 125, 27, 105]
B=[57, 134, 137, 129, 145, 60, 49]
Def bar_charts () - & gt; Bar:
Bar1=(
Bar (init_opts=opts. InitOpts (width="1000 px", height='500 px)) # sample object
. Add_xaxis (fushi) # x data
Add_yaxis (merchants A, A) # legend name + y data
. Add_yaxis (merchants "B", B)
# global configuration: the title/subtitle
Set_global_opts (title_opts=opts. TitleOpts (title="mall sales 1"),
Tooltip_opts=opts. TooltipOpts (trigger='axis', axis_pointer_type=' cross '), # pointer type, cross/shadow/line/no
Toolbox_opts=opts. ToolboxOpts (
Is_show=True))
# bar to expand
Extend_axis (
# yaxis=opts. AxisOpts (on the right side of the y axis tag
Name='price',
Type_='value', # type
Min_=0,
Max_=100,
Spacing interval=10, #
Axislabel_opts=opts. LabelOpts (formatter='${value}') # label according to
)
)
)
Return bar1
Y=[36,87,75,48,32,86,25]
Def line_charts () - & gt; The Line () :
, line1=(
The Line ()
. Add_xaxis (fushi)
Add_yaxis (' price ', y, yaxis_index=1, # line graph on the right side of the index, so 1
Label_opts=opts. LabelOpts (is_show=True), is_smooth=True)
)
Return, line1
Bar1=bar_charts ()
, line1=line_charts ()
#, line1. Render_notebook ()
Bar1. Overlap (, line1). Render_notebook ()
Pray god to help me solve ~ thank you ~
CodePudding user response:
With o + + + + + + + + + + + + + 1