I want to plot date on one side of the y-axis and count on the other side. Hence hence for each x-value i want it grouped so one bin relates to the date and the other to the count.
I have tried this
import streamlit as st
import pandas as pd
from plotly.subplots import make_subplots
import plotly.graph_objects as go
#from sql_engine import make_engine
df = pd.read_csv('d.csv')
fig=make_subplots(
rows=1,
cols=1,
shared_xaxes=True,
specs=[[{'secondary_y': True}]]
)
print(fig.layout)
fig.add_trace(
go.Bar(
x = df.get('x').to_list(),
y = df.get('ts').to_list(),
name='ts',
marker_color='indianred'
),
row=1,
col=1,
secondary_y=False
)
fig.add_trace(
go.Bar(
x = df.get('x').to_list(),
y = df.get('cnt').to_list(),
name='cnt',
marker_color='lightsalmon'
),
row=1,
col=1,
secondary_y=True
)
fig.update_layout(xaxis_tickangle=-45)
fig.show()
but at the moment the bars just get stacked on eachother. I have tried to update barmode to grouped.
Ekstra question if it’s possible to make orientation horizontal