Python在3D网格上散射图

发布于 2025-02-08 15:12:21 字数 324 浏览 1 评论 0原文

我有一个我想在Plotly上渲染的STL(网格)文件。我发现

导入plotly.graph_objects作为go

platly的go对象。 我想在同一图上制作一个散点图,不确定如何做到这一点。 最后,问题是将Plotly Graph_Object与Ploty Express对象一起使用(至少这是我认为可以做到的解决方案。)如果您知道如何渲染网格并在其上呈现一些要点,那将是很棒的。<<<<<<<<<<<<<<<<<< br> 谢谢

I have an STL(mesh) file that I want to render on plotly. I found this library which is using

import plotly.graph_objects as go

the go object of plotly.
and I want to make a scatter plot on the same graph and not sure how to do that.
At the end the problem is using the plotly graph_object with ploty express object together (at least this is the solution that I think can be done. ) If you know how to render a mesh and render some points on it it would be great.
Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初心 2025-02-15 15:12:21

您需要将轨迹添加到一个图形中。

例如:

import plotly.graph_objects as go
import numpy as np

pts = np.loadtxt(np.DataSource().open('https://raw.githubusercontent.com/plotly/datasets/master/mesh_dataset.txt'))
x, y, z = pts.T

mesh = go.Mesh3d(x=x, y=y, z=z, color='lightpink', opacity=0.50)
scatter = go.Scatter3d(x=x, y=y, z=z, mode='markers')

fig = go.Figure(data=[mesh, scatter])

fig.show()

“在此处输入图像描述”

You need to add the traces to a single Figure.

For example:

import plotly.graph_objects as go
import numpy as np

pts = np.loadtxt(np.DataSource().open('https://raw.githubusercontent.com/plotly/datasets/master/mesh_dataset.txt'))
x, y, z = pts.T

mesh = go.Mesh3d(x=x, y=y, z=z, color='lightpink', opacity=0.50)
scatter = go.Scatter3d(x=x, y=y, z=z, mode='markers')

fig = go.Figure(data=[mesh, scatter])

fig.show()

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文