Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fig = make_subplots(specs=[[{"secondary_y": True}]])
- trace0 = go.Scatter(x=df.index,
- y=df.gold,
- name="Золото",
- line=dict(color='#f5c541'),
- yaxis='y1')
- trace1 = go.Bar(x=sell_silver.index, # assign x as the dataframe column 'x'
- y=sell_silver['Реализовано'],
- name = 'Реализовано',
- marker=dict(
- color='green',
- opacity=0.1,
- line=dict(
- color='black',
- width=2
- )
- ),
- yaxis='y2',
- # width=0.01
- )
- trace2 = go.Bar(x=sell_silver.index, # assign x as the dataframe column 'x'
- y=sell_silver['Тираж'],
- name = 'Тираж',
- marker = dict(
- color='red',
- opacity=0.1,
- line=dict(
- color = 'black',
- width=2)
- ),
- yaxis='y2',
- # width=0.01,
- )
- fig.add_trace(trace0,
- secondary_y=True)
- fig.add_trace(trace1,
- secondary_y=False)
- fig.add_trace(trace2,
- secondary_y=False)
- fig.update_layout(
- # barmode='stack',
- barmode='relative',
- plot_bgcolor='rgba(0,0,0,0)',
- title_text="Серебро (2018 - 2020 год)",
- title_x = 0.5,
- width=1024,
- height=600,
- legend=dict(x=.45,
- xanchor="center",
- orientation="h"))
- # Set x-axis title
- fig.update_xaxes(title_text="<b>Годы</b>",
- gridcolor='lightblue')
- # Set y-axes titles
- fig.update_yaxes(title_text="<b>Цена на серебро</b> (р./грамм)",
- secondary_y=True,
- # gridcolor='#f5c541'
- side='left')
- fig.update_yaxes(title_text="<b>Шт.</b>",
- secondary_y=False,
- gridcolor='#1167b1',
- side='right')
- fig.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement