✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Auto scale Plotly express

My x and y-axis are not automatically scaling as my plot progresses through its animation. I have to use the autoscale button at the end of the animation to overcome this.
I have tried
Animate = False,
autorange=True in .update_xaxes and .update_yaxes,
autosize=True in .update_layout,
range_x=[0, x], range_y=[0, y],

My code is below:

import plotly.express as px
import pandas as pd
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import flask

server = flask.Flask(__name__)
app = dash.Dash(__name__, server=server)

dataset = pd.read_csv('/Users/mythilisutharson/documents/cam_work/mof_explorer_flourish/MOF_trans_data_bad_edit.csv')
col_options = [dict(label=x, value=x) for x in dataset.columns]
features = dataset.columns

styles = {
    'pre': {}
tabs_styles = {}
tab_style = {}

tab_selected_style = {}

dimensions = ['select x variable', 'select y variable ', 'select color variable', 'select size variable']
app.layout = html.Div(
        html.H1("", style={}),
        html.Div(" ", style={}),
                            html.Div([dcc.Graph(id="graph", animate=False,
                                                ), ],
                                     style={"width": "80%", "display": "inline-block"}),
                                    html.P([d + ":", dcc.Dropdown(id=d,
                                                                  options=[{'label': i, 'value': i} for i in features
                                    for d in dimensions

                                style={'display': 'inline-block', 'width': '25%', 'fontSize': 14,
                                       'font-family': 'Arial'},

    ], style={}  # style for outter div

@app.callback(Output("graph", "figure"), [Input(d, "value") for d in dimensions])
def make_figure(x, y, color, size):
    return px.scatter(dataset, x=x, y=y, title="MOF Explorer", animation_frame="Pressure",
                      animation_group="DDEC Code", size=size, color=color,
                      hover_name="DDEC Code", color_continuous_scale='Viridis',
                      hover_data={"DDEC Code", "Density", "Void Fraction"}, template="plotly_white",

                      ).update_xaxes(showgrid=False, title=x, autorange=True, fixedrange=False).update_yaxes(
        showgrid=False, title=y, autorange=True, fixedrange=False).update_layout(
        clickmode='event+select', hovermode='closest', margin={'l': 50, 'b': 80, 't': 50, 'r': 10}, autosize=True


And the data for this file can be accessed here:

Thank you!

did you manage to solve it?