X_range argument not working in histogram with marginal='rug'


I am currently trying to create a histogram with plotly express, and I have enabled marginal='rug'. Unfortunately, it looks like the x_range argument is not used correctly in the histogram, see screenshot below. In this particular case, I set n_bins to 100.

For debugging purposes, I also tried to set n_bins to end-start (so that every position gets one bar), and you can see that it is still off.

To me, it looks like x_range works fine for the histogram, but not for the rug plot. Most notably, the vertical lines and the tick labels do not match up.

Am I missing some argument here or is this a bug in plotly express? Here’s the code for my plot:

histogram = px.histogram(df, x='start', color='strand',
                                 range_x=[start, end], height=300,
histogram.update_layout(showlegend=False, margin={'l': 65, 'r': 10, 't': 10, 'b': 40, 'autoexpand': False}, yaxis_title='number of insertions', xaxis_title='genomic position')

Thank you for your help!

I figured out that the error originated from a line below, where I called histogram.update_xaxes(fixedrange=True). Apparently this does not work together with the rug display. Simply removing it fixed the issue.