Hey @mortenb123 welcome to the forums.
This is because the x-pos values get interpreted as timestamp and a time axis is used. If there are gaps in your data, this is shown as is in the graph. Try specifying the axis type as category
:
layout = go.Layout(barmode='stack', xaxis= {'type': 'category'})