plotly / plotly/plotly.py

graph_objs.volume and .isosurface not rendering non-cuboid

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

Chưa có ai nhận issue này.

bug P3
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ả

I'm trying to use plotly in a dash app to render a cuboid, that's sheared to the y-axis.=it has a parallelogram as ground surface. It consists of individual points, each with a density value. plotly_express.scatter_3d renders the individual points correctly, but only has "2 views" when rotating it:

  • One where the closest face is rendered
  • -> you can't look inside very well
  • One where both the closest face and the inside of the structure are not rendered
  • -> you can only see the 2 rear side faces, but from the inside

With both, I'm losing a lot of information on the insides of my structure.
I think scatter_3d doesn't allow for

  • a) all points to stay rendered at all times
  • b) me to link each individual points opacity to its density value (like it does with color)¹

Best looking solution would be graph_objs.Volume or .isosurface, but they have an issue.

So far, the coordinates data had to be arranged to form an orthogonal cuboid, to render a volume.
My test data is not the same y-sheared cuboid I want to achieve, but it illustrates the issue of both graph_objs.

Test Data:
Using plotly_express.scatter_3d() for comparison, the following dataframe shows both Figures rendering the expected result:

DF = pd.DataFrame(data={
    'x': [0, 0, 0, 0, 0, 0, 1,1,1,1,1,1],
    'y': [0,0,0,1,1,1,0,0,0,1,1,1],
    'z': [0,1,2,0,1,2,0,1,2,0,1,2],
    'val': [1,1,1,1,1,1,1,1,1,1,1,1]})

scatter plot:
points

volume plot:
points volume

When removing 2 points at (0/1/2) & (1/1/2) -

DF = pd.DataFrame(data={
    'x': [0, 0, 0, 0, 0, 1,1,1,1,1],
    'y': [0,0,0,1,1,0,0,0,1,1],
    'z': [0,1,2,0,1,0,1,2,0,1],
    'val': [1,1,1,1,1,1,1,1,1,1]})
  • go.Volume breaks.

scatter plot:
scattermissing

volume plot:
vol missing

scatter_3d figure:

px.scatter_3d(
    DF,
    x='x',
    y='y',
    z='z',
    color='val',
    opacity=0.5,
    color_continuous_scale=px.colors.sequential.Inferno_r,
    range_color=[df.min()['val'], df.max()['val']],
    template=templ)

opacity doesn't take lists/ranges, so I can't use DF.val there.

Volume figure:

go.Figure(data=go.Volume(
    x=DF.x,
    y=DF.y,
    z=DF.z,
    value=DF.val,
    opacity=0.3,
    surface_count=17,
    colorscale=px.colors.sequential.Inferno_r
))

I played around with surface_count, but it doesn't seem to be causing the problem.

My 2 points being:

  • go.Volume/.isosurface don't work if angles of !=90° are involved
  • px.scatter_3d deserves some more configuration-options, especially opacity-wise

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.

Hướng nghiên cứu

Tái hiện các ví dụ plotly_express.scatter_3d và go.Volume được cung cấp, bao gồm các tập dữ liệu đầy đủ và các tập dữ liệu có điểm bị thiếu. Bắt đầu với các entry point go.Volume và go.Isosurface rồi so sánh hành vi của chúng đối với các tọa độ bị shear và các điểm bị thiếu. Done phải xác định liệu các đầu vào này có được hỗ trợ hay không, đồng thời khắc phục hoặc ghi lại một cách rõ ràng hạn chế kết xuất đã quan sát.

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ó
4/5
Thời gian dự kiến
3-5 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
35/100

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.