本文整理汇总了Python中plotly.graph_objs.Scatter3d方法的典型用法代码示例。如果您正苦于以下问题:Python graph_objs.Scatter3d方法的具体用法?Python graph_objs.Scatter3d怎么用?Python graph_objs.Scatter3d使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plotly.graph_objs
的用法示例。
在下文中一共展示了graph_objs.Scatter3d方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot_traj
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scatter3d [as 别名]
def plot_traj(self, qt, **kwargs) :
if self.vis_mode == '2D' :
trajs = self.periodize_traj(qt)
for traj in trajs :
# (r,theta) -> (y,x)
curve = go.Scatter(x = traj[:,1], y = traj[:,0], mode = 'lines', hoverinfo='none', **kwargs)
self.current_axis.append(curve)
elif self.vis_mode == '3D' :
if type(qt[0]) is not list :
qt = [qt]
if self.upsample_trajs :
qt = list( self.upsample(q) for q in qt )
traj = list( self.I(q = q) for q in qt )
separator = array([None]* 3).reshape((1,3))
traj = vstack( vstack((i, separator)) for i in traj )
curve = go.Scatter3d(x = traj[:,0], y = traj[:,1], z = traj[:,2], mode = 'lines', hoverinfo='none', **kwargs)
self.current_axis.append(curve)
# Vector field display
示例2: quiver_3D
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scatter3d [as 别名]
def quiver_3D(self, qt, vt, **kwargs) :
if qt.shape[1] == 2 :
Qt = self.I(qt)
Vt = self.dI(qt, vt)
elif qt.shape[1] == 3 :
Qt = qt
Vt = vt
# quiver3 is not implemented by plotly.js :
# we have to settle for a poor derivative...
H = Qt
T = H + Vt
arrows = go.Scatter3d(
x = (hstack(tuple( (H[i,0], T[i,0], None) for i in range(T.shape[0]) ))),
y = (hstack(tuple( (H[i,1], T[i,1], None) for i in range(T.shape[0]) ))),
z = (hstack(tuple( (H[i,2], T[i,2], None) for i in range(T.shape[0]) ))),
mode = 'lines',
**kwargs
)
self.current_axis.append(arrows)
示例3: display_scatter_3d_1
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scatter3d [as 别名]
def display_scatter_3d_1(value,figure):
x, y, z = np.random.multivariate_normal(
np.array([0, 0, 0]), np.eye(3), 2).transpose()
figure['data']=[
go.Scatter3d(
x=x,
y=y,
z=z,
mode='markers',
)
]
return figure
示例4: display_scatter_3d_2
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scatter3d [as 别名]
def display_scatter_3d_2(value,figure):
x, y, z = np.random.multivariate_normal(
np.array([0, 0, 0]), np.eye(3), 2).transpose()
figure['data']=[
go.Scatter3d(
x=x,
y=y,
z=z,
mode='markers',
)
]
return figure
示例5: display_scatter_3d_3
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scatter3d [as 别名]
def display_scatter_3d_3(value,figure):
x, y, z = np.random.multivariate_normal(
np.array([0, 0, 0]), np.eye(3), 2).transpose()
figure['data']=[
go.Scatter3d(
x=x,
y=y,
z=z,
mode='markers',
)
]
return figure
示例6: get_trace3d
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scatter3d [as 别名]
def get_trace3d(points3d, point_color=None, line_color=None, name="PointCloud"):
"""Yields plotly traces for visualization."""
if point_color is None:
point_color = "rgb(30, 20, 160)"
if line_color is None:
line_color = "rgb(30, 20, 160)"
# Trace of points.
trace_of_points = go.Scatter3d(
x=points3d[:, 0],
y=points3d[:, 2],
z=points3d[:, 1],
mode="markers",
name=name,
marker=dict(
symbol="circle",
size=3,
color=point_color))
# Trace of lines.
xlines = []
ylines = []
zlines = []
for line in CONNECTIONS:
for point in line:
xlines.append(points3d[point, 0])
ylines.append(points3d[point, 2])
zlines.append(points3d[point, 1])
xlines.append(None)
ylines.append(None)
zlines.append(None)
trace_of_lines = go.Scatter3d(
x=xlines,
y=ylines,
z=zlines,
mode="lines",
name=name,
line=dict(color=line_color))
return [trace_of_points, trace_of_lines]
示例7: render
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scatter3d [as 别名]
def render(self):
""" Plot the figure. Call this last."""
traces = []
for dataset in self.xy_datasets:
kwargs = {}
if 'name' in dataset and dataset['name'] is not None:
kwargs['name'] = dataset['name']
self.zindex = kwargs['name']
else:
kwargs['showlegend'] = False
zvals = np.full(np.size(dataset['x']), self.zindex)
traces.append(Scatter3d(
x = dataset['x'],
z = dataset['y'],
y = zvals,
mode = 'lines',
**kwargs
))
if not isinstance(self.zindex, str):
self.zindex += 1
data = Data(traces)
plotly.offline.iplot({
'data': data,
'layout': self.makeLayout()
})
示例8: scatter_plot3d_plotly
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scatter3d [as 别名]
def scatter_plot3d_plotly(embedding, coloring=None,
colorscale='Rainbow', **kwargs):
import plotly.graph_objs as go
x,y,z = embedding[:,:3].T
if isinstance(coloring, str) and coloring.lower() in 'xyz':
color_idx = 'xyz'.find(coloring)
coloring = embedding[:,color_idx].flatten()
marker = kwargs.pop('marker',None)
name = kwargs.pop('name','Embedding')
scatter_plot = go.Scatter3d(
x=x,
y=y,
z=z,
mode='markers',
marker=dict(
size=2,
opacity=0.8,
),
name=name,
**kwargs
)
if coloring is not None:
scatter_plot['marker'].update(dict(
color=coloring,
colorscale=colorscale,
showscale=True,
))
elif marker is not None:
scatter_plot['marker'].update(marker)
return [scatter_plot]
示例9: create_ellipse_mesh
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scatter3d [as 别名]
def create_ellipse_mesh(points,**kwargs):
"""Visualize the ellipse by using the mesh of the points."""
import plotly.graph_objs as go
x,y,z = points.T
return (go.Mesh3d(x=x,y=y,z=z,**kwargs),
go.Scatter3d(x=x, y=y, z=z,
marker=dict(size=0.01),
line=dict(width=2,color='#000000'),
showlegend=False,
hoverinfo='none'
)
)
示例10: show_glyphs
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scatter3d [as 别名]
def show_glyphs(self, scale = 0.03, axis = 'Z') :
"Displays triangles on the spherical manifold."
if self.mode == 'whole sphere' or self.mode == 'spherical blackboard' :
# We will embed self.triangles in the euclidean space R^3,
# in the neighborhood of the sphere S(1/2).
if axis == 'X' :
theta = self.theta
phi = self.phi
e_theta = vstack( ( -sin(theta) , cos(theta) * cos(phi), cos(theta) * sin(phi) ) ).T
e_phi = vstack( ( zeros(theta.shape) , -sin(theta) * sin(phi), sin(theta) * cos(phi) ) ).T
elif axis == 'Z' :
theta = self.theta_Z
phi = self.phi_Z
e_theta = - vstack( ( cos(theta) * cos(phi), cos(theta) * sin(phi), -sin(theta) ) ).T
e_phi = + vstack( ( - sin(phi), cos(phi), zeros(theta.shape) ) ).T
# We don't want glyphs to overlap
e_theta = scale * e_theta
e_phi = scale * e_phi
glyphs = []
separator = [None, None, None]
for i in range(self.triangles.shape[0]) :
point = array([self.X[i], self.Y[i], self.Z[i]])
glyphs.append(array([
point + real(self.triangles[i,0]) * e_phi[i] + imag(self.triangles[i,0]) * e_theta[i] , # A
point + real(self.triangles[i,1]) * e_phi[i] + imag(self.triangles[i,1]) * e_theta[i] , # B
point + real(self.triangles[i,2]) * e_phi[i] + imag(self.triangles[i,2]) * e_theta[i] , # C
point + real(self.triangles[i,0]) * e_phi[i] + imag(self.triangles[i,0]) * e_theta[i] , # A
separator
]))
glyphs = vstack(glyphs)
curves = go.Scatter3d(x = glyphs[:,0], y = glyphs[:,1], z = glyphs[:,2], mode = 'lines', hoverinfo='none', name = 'Triangles')
self.current_axis.append(curves)
示例11: marker_3D
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Scatter3d [as 别名]
def marker_3D(self, q, **kwargs) :
if q.shape[1] == 2 :
Q = self.I(q = q)
elif q.shape[1] == 3 :
Q = q
points = go.Scatter3d(x = Q[:,0], y = Q[:,1], z = Q[:,2], mode = 'markers', hoverinfo='name', **kwargs)
self.current_axis.append(points)