Ranges not properly constraining graph

Hi,
I’m running into an issue where a graph I’m creating is not properly having its x and y axis ranges constrained by update_xaxes and update_yaxes, and in particular the graph possibly seems to base its size on whatever the width of the viewport is. I’m a little lost on why this is happening.

            fig = go.Figure()

            fig.update_layout(
                plot_bgcolor = 'white',
                autosize = False,
                # width = 500,
                # height = 500,
            )
            fig.update_xaxes(
                showline = True,
                linecolor = 'black',
                mirror = True,
                range = [xmin, xmax],
                title_text = 'relative x position (degrees)',
            )
            fig.update_yaxes(
                showline = True,
                linecolor = 'black',
                mirror = True,
                range = [ymin, ymax],
                title_text = 'relative y position (degrees)',
                scaleanchor = 'x',
                scaleratio = 1,
            )

The resulting graph:


In this case, xmin = ymin = -0.001207, and xmax = ymax = 0.001207.
I am using Dash version 2.11.1 and Plotly version 5.15.0.
Thanks for the help.

Maybe you have to increase the number of digits for your ticks. Search for formatting ticks.

1 Like