Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
Closed
@tvaucher

Description

@tvaucher
Issue body actions

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.