I have two traces on my plot, the first trace would be the bar chart, and the second one would be the line on another yaxis, how can I adjust it so that I can see both charts with a slight βgapβ. This is how my plot looks like when generated:
And this is how I want it to be (adjusted manually) :
Do you know which parameter changes will I need to adjust to get it that way.
Code so far :
fig = px.bar(df, x = "Timestamp", y = 'SUM_kWh', barmode='group')
fig.add_traces(go.Scatter(x= dfx.Timestamp, y=dfx.SUM_kWh, text=dfx.SUM_kWh.apply(lambda val: f"{val/1000:.1f} kW"), textposition= "top center", textfont = {"size" : 8}, mode='lines+markers+text', yaxis="y2", line_shape='spline'))
fig.update_layout(
yaxis2=dict(
overlaying="y",
side="right",
range=[0, dfx['SUM_kWh'].max() * 0.9], # Adjust the upper range
autorangeoptions = dict(
include = dfx['SUM_kWh'].max() * 1.9,
maxallowed = dfx['SUM_kWh'].max() * 1.9,
),
showgrid=False,
zeroline=False,
title="Total kWh",
autoshift = True,
#fixedrange=True
),
yaxis=dict(
title="SUM_kWh (kW)", # Set title for the left y-axis
range=[0, df['SUM_kWh'].max() * 1.2] # Adjust the range for yaxis
),
autosize=True,
legend=dict(
x=1.05,
y=0.5,
traceorder="normal",
))