I have a scenario in which I need to create a stacked bar chart with percentages and append the absolute value to the x label as shown in this :
The issue here is that the the absolute numbers come from a different data series than from which the stacked layout is being generated. Is there anyway I can add that in the plot. Following is the code snippet :
monthlyTime = MonthlyData.Year_mon_date
#I need to append values from the following data in the x-axis as in figure. e.g. (10), (20) etc
#monthlyActualData.iloc[0,0] = 10
#monthlyActualData.iloc[0,1] = 20
R_adj = MonthlyData.R_adj
F_adj = MonthlyData.F_adj
figure = go.Figure(
data = [
go.Bar(
x=monthlyTime,
y=R_MONO_adj,
name='R Mono',
marker=go.bar.Marker(
color='rgb(19, 48, 71)'
)
),
go.Bar(
x=monthlyTime,
y=R_FC_F_adj,
name='R + FC/F',
marker=go.bar.Marker(
color='rgb(100, 161, 212)'
)
),
layout = go.Layout(
showlegend=True,
barmode = 'stack',
boxmode = 'overlay',
legend=dict(x=1.1, y=0,orientation="v"),
xaxis={
"title":'Time Period : ',
'rangeslider': {'visible': True},
'type': 'date'
},
yaxis={'title': ,
"tickformat" : '.0%',
'range' : [0,1]
},
margin=go.layout.Margin(l=90, r=0, t=20, b=20)
)
)
return figure