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

Plotly Express density_mapbox, attribute 'opacity' raises ValueError #2316

Closed
tvaucher opened this issue Mar 26, 2020 · 0 comments
Closed

Plotly Express density_mapbox, attribute 'opacity' raises ValueError #2316

tvaucher opened this issue Mar 26, 2020 · 0 comments
Milestone

Comments

@tvaucher
Copy link
Contributor

Description

Hello,
When passing the opacity attribute different than None to px.density_mapbox, it raises a ValueError.

Expected output

Taking the example in the doc and wanting to set the opacity to 0.5:
image

Minimal reproducible code

import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/earthquakes-23k.csv')

import plotly.express as px
fig = px.density_mapbox(df, lat='Latitude', lon='Longitude', z='Magnitude', radius=10,
                        center=dict(lat=0, lon=180), zoom=0,
                        mapbox_style="stamen-terrain", opacity=0.5)
fig.show()

Current workaround

It's possible to change the opacity by not adding the attribute in the constructor but adding it after using fig.update_traces(opacity=0.5). But I'll open a PR with a fix so you don't have to use that.

tvaucher added a commit to tvaucher/plotly.py that referenced this issue Mar 26, 2020
tvaucher added a commit to tvaucher/plotly.py that referenced this issue Mar 26, 2020
@nicolaskruchten nicolaskruchten added this to the v4.6.0 milestone Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants