Missing colorscales in ui buttons
Chưa có ai nhận issue này.
- 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ả
In the following code I created a simple plot with a dropdown menu where each button is expected to modify the colorscale. However, some of these don't seem to work properly and when the corresponding button is clicked, a default colorscale is applied instead.
import plotly.graph_objects as go
import numpy as np
# Generate sample data
np.random.seed(42)
x = np.random.rand(100)
y = np.random.rand(100)
z = np.sqrt(x**2 + y**2)
# Available colormaps
colorscales = ['Viridis', 'Cividis', 'Plasma', 'Inferno', 'Magma']
# Create the initial figure with one colorscale
scatter = go.Scatter(
x=x,
y=y,
mode='markers',
marker=dict(
size=10,
color=z,
colorscale=colorscales[0],
colorbar=dict(title='Value'),
showscale=True
)
)
fig = go.Figure(data=[scatter])
# Add dropdown menu
fig.update_layout(
updatemenus=[
dict(
buttons=[
dict(
label=scale,
method='restyle',
args=[{'marker.colorscale': [scale]}]
)
for scale in colorscales
],
direction='down',
showactive=True,
x=1.1,
y=1
)
],
title="Scatter Plot with Colormap Dropdown",
xaxis_title="X",
yaxis_title="Y"
)
fig.show()
In this plot only 'Viridis' and 'Cividis' colorscales are supported. More in general it seems to me that the only supported ones are those defined in plotly.colors.plotlyjs (only the non-reversed ones).
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách chạy bản tái hiện Python được cung cấp và so sánh hành vi của menu thả xuống với các tên có sẵn trong plotly.colors.plotlyjs. Theo dõi cách figure Plotly Python tuần tự hóa các giá trị colorscale cho các nút; hoàn tất khi các colorscales được liệt kê được chấp nhận và áp dụng nhất quán khi được chọn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- data-visualization
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100