Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Map does not initially render in correct size #155

Description

@nchelaru

Hello!

I am creating a Dash app that includes a map made using the following code:

def map(df):
    fig = px.scatter_mapbox(df, lat="Latitude", lon="Longitude", size="Log(TotalRevenue)",
                            color = "Log(TotalRevenue)",  color_continuous_scale=px.colors.sequential.YlOrRd,
                            zoom=2, size_max=10, hover_name='Location', animation_frame='Year',
                            category_orders={'Year':[2010, 2011, 2012, 2013, 2014, 2015, 2016]})

    fig.update_layout(margin=dict(l=15, r=15, t=10, b=10),
                      autosize=True)

    return fig

The map is embeded in the Dash app like so:

dcc.Graph(
            figure=map(df),
            style={'width':'55vw', 'height':'inherit'}
        )

The strange thing is that on start-up of the app, the map almost always shows up in a smaller size.

Screen-Shot-2019-10-23-at-9-45-10-AM

When I click on the animation button, the map then pops into the right size.

Screen-Shot-2019-10-23-at-9-45-24-AM

Is there a way to correct this?

Thank you very much!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions