[BUG]: Changing marker.colorscales with a dropdown menu doesn't work for most colors
@emilykl 已经在做这个了。
开始于 2026年1月14日。
评估
这个 Issue 还没有评估数据。
描述
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.
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 13 小时 41 分钟
- 30 天内合并 PR
- 21
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
plotly/plotly.py 的其他 Issue
-
P3 size: 1 task
难度 2/5 1-3 小时 新手友好度 65/100
-
P3 size: 1 task
难度 2/5 1-3 小时 新手友好度 72/100
-
bug P1
难度 1/5 1 小时以内 新手友好度 68/100
-
feature P3
难度 2/5 1-3 小时 新手友好度 62/100
-
feature P3
难度 2/5 1-3 小时 新手友好度 72/100
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
canonical/paas-charm#368 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
tech debt
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 1/5 1 小时以内 新手友好度 90/100
StevenBlack/hosts#3256 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
qualcomm/qai-appbuilder#275 ·