plotly / plotly/plotly.py

[BUG]: Changing marker.colorscales with a dropdown menu doesn't work for most colors

Đang mở
#5,462 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@emilykl đang làm issue này rồi.

Từ ngày 14/1/2026.

bug
Ngôn ngữ chính
Python
Star
18.8k
Fork
2.8k
Merge trung bình
16 giờ 26 phút
Pull request đã merge (30 ngày)
21

Mô tả

Changing marker.colorscales with a dropdown menu doesn't work for most colors, as can be seen in the example below:

import numpy as np
import itertools as it
from plotly import graph_objs as go

x, y = np.array([*zip(*it.combinations(range(20), 2))])
z = np.random.random(len(x))
colors = ['Brwnyl', 'Agsunset', 'Sunsetdark', 'Magenta', 'Sunset', 'Purpor', 'Purp', 'Tealgrn', 'Teal', 'Bluyl', 'Aggrnyl', 'Emrld', 'Darkmint', 'Blugrn', 'Mint', 'Pinkyl', 'Peach', 'Oryel', 'Redor', 'Burgyl', 'Burg', 'tempo', 'amp', 'speed', 'matter', 'algae', 'dense', 'deep', 'gray', 'ice', 'solar', 'haline', 'thermal', 'turbid', 'YlOrRd', 'YlOrBr', 'YlGnBu', 'YlGn', 'Reds', 'RdPu', 'RdBu', 'Purples', 'PuRd', 'PuBuGn', 'PuBu', 'Oranges', 'OrRd', 'Greys', 'Greens', 'GnBu', 'BuPu', 'BuGn', 'Blues', 'Rainbow', 'Jet', 'Hot', 'Electric', 'Bluered', 'Blackbody', 'Turbo', 'Plasma', 'Magma', 'Inferno', 'Cividis', 'Viridis', 'Plotly3', 'Portland', 'Picnic', 'Earth', 'Tropic', 'Tealrose', 'Temps', 'Geyser', 'Fall', 'Armyrose', 'oxy', 'curl', 'delta', 'balance', 'Spectral', 'RdYlGn', 'RdYlBu', 'RdGy', 'PuOr', 'PiYG', 'PRGn', 'BrBG']

fig = go.Figure()
fig.add_scatter3d(
    x=x, y=y, z=z,
    mode="markers",
    marker=dict(
        line=dict(width=0.1, color="black"),
        size=z*10,
        color=z,
        colorscale="Turbo",
        showscale=True,
    ),
)
fig.update_layout(
    updatemenus=[
        dict(
            buttons=[
                dict(label=color, method="restyle", args=[{
                    "marker.colorscale": color,
                }, [0]])
                for color in colors
            ],
        ),
    ],
)
fig.show()

Note that "Turbo" works when setting the figure, but not when updating it with a button.
Using Python=3.14.2 and Plotly=6.5.1.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.