Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

annotations for mapbox subplots #5142

Open
ougx opened this issue Sep 4, 2020 · 3 comments
Open

annotations for mapbox subplots #5142

ougx opened this issue Sep 4, 2020 · 3 comments

Comments

@ougx
Copy link

ougx commented Sep 4, 2020

When it is regular layout it works (see code below).

dcc.Graph(
    id='map',
    figure=dict(
        data=[
            go.Scatter( ... )
        ],
        layout=dict(
            # mapbox=dict(
            #     style='white-bg',
            #     center={'lat':42, 'lon':-97},
            #     zoom=6
            # ),
            annotations=[
                dict(
                    x=-96,
                    y=43,
                    xref='x',
                    yref='y',
                    ax=30,
                    ay=30,
                    text='here',
                    showarrow=True,
                )
            ]
        )
    )
)

But if you uncomment the mapbox section and change go.Scatter to go.Scattermapbox it will always add the annotation to the center of the view and is stagnant even when you move the map.

  • replace the result of pip list | grep dash below
dash                          1.14.0
dash-bootstrap-components     0.10.5
dash-core-components          1.10.2
dash-defer-js-import          0.0.2
dash-html-components          1.0.3
dash-renderer                 1.6.0
dash-split-pane               1.0.0
dash-table                    4.9.0
django-plotly-dash            1.4.2

Expected behavior

Mapbox annotations act the same as for regular layouts.

@ougx ougx closed this as completed Sep 4, 2020
@ougx ougx reopened this Sep 4, 2020
@chriddyp chriddyp transferred this issue from plotly/dash Sep 11, 2020
@nicolaskruchten
Copy link
Member

This is more of a known scope limitation/feature-request than a bug... layout.annotations only work in paper or 2d-cartesian coordinates today. We would need to add something like mapxbox1 to the possible accepted values of xref and yref to make this work, and it would need to be deeply integrated into our Mapbox code, which is a bit of a project :)

@nicolaskruchten nicolaskruchten changed the title [BUG] annotations for mapbox layout does not move when panning the map annotations for mapbox subplots Sep 14, 2020
@Ture2019
Copy link

Ture2019 commented May 22, 2021

Very well its a feature not a bug. Where is the upvote button? How many years does the python community need to wait for an easy to use python library to be able to easily draw on a map? Plotly is our best shot. And annotations are essential!

@nicolaskruchten
Copy link
Member

We'd be happy to work with anyone who wants to help contribute such a feature instead of "waiting" :)

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

No branches or pull requests

3 participants