plotly / plotly/plotly.py

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

オープン
#5,462 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

@emilykl がすでに取り組んでいます。

2026年1月14日 から。

bug
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。