Transparent markers misbehaving in plotly.express.scatter
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ả
Description
I create a scatter plot and use the color and size arguments. One subset gets transparent markers and is not visible in the plot and the legend.
But: if I hover over an area, where a marker should be, the tool tip is appearing, see figure below:
Expected Behavior
Marker should be visible in plot and legend.
Reproduction
Running the code below I get the figure above.
# %%
# Imports
import sys
import plotly
import pandas as pd
import plotly.express as px
print(f'Python version: {sys.version}') # Mine is: 3.11.9
print(f'Pandas version: {pd.__version__}') # Mine is: 2.2.2
print(f'Plotly version: {plotly.__version__}') # Mine is: 5.22.0
# %%
# Create input frame
df = pd.DataFrame(
[
[11739,21.329416,10.010795,2,1],
[20500,21.860714,12.238669,2,2],
[1504,21.927166,10.314574,2,1],
[28194,21.257576,12.823945,2,3],
[9008,21.886381,9.579169,2,1],
[17073,21.57327,11.087076,2,1],
[40734,21.069445,11.887547,3,0],
[36405,22.397081,11.608735,3,0],
[36919,21.95463,12.856195,3,0],
[9867,20.893126,10.761697,2,1]
],
columns=['id' ,'x', 'y', 'loop_number', 'repetition']
)
df.set_index('id', inplace=True)
df.x = df.x.astype('float32')
df.y = df.y.astype('float32')
df.loop_number = df.loop_number.astype('category') # As category to use color labels, not a color bar.
df.repetition = df.repetition.astype('int32')
df.head()
# %%
# Create Scatter Plot
px.scatter(
df,
x='x',
y='y',
color='loop_number',
size='repetition',
labels={
'color': 'Type',
'size': 'Size'
},
hover_name=df.index
)
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
Chạy bản tái hiện Python được cung cấp thông qua plotly.express.scatter với color='loop_number' và size='repetition'. Kiểm tra lý do tập con trong suốt bị bỏ qua khỏi cả biểu đồ lẫn chú giải, mặc dù vẫn có thể hover để xem; được coi là hoàn tất khi các marker và mục chú giải của tập con đó đều hiển thị, đồng thời duy trì hành vi scatter đã được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- pandas, 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
- 45/100