Python plotly.graph_objs.Scatter3d() Examples
The following are 11
code examples of plotly.graph_objs.Scatter3d().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
plotly.graph_objs
, or try the search function
.
Example #1
Source File: surface_of_revolution.py From lddmm-ot with MIT License | 6 votes |
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
Example #2
Source File: surface_of_revolution.py From lddmm-ot with MIT License | 6 votes |
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)
Example #3
Source File: dash-webgl-contexts.py From dash-recipes with MIT License | 5 votes |
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
Example #4
Source File: dash-webgl-contexts.py From dash-recipes with MIT License | 5 votes |
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
Example #5
Source File: dash-webgl-contexts.py From dash-recipes with MIT License | 5 votes |
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
Example #6
Source File: motion_capture.py From deep-nrsfm with BSD 3-Clause "New" or "Revised" License | 5 votes |
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]
Example #7
Source File: engine_plotly.py From tellurium with Apache License 2.0 | 5 votes |
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() })
Example #8
Source File: scatter_3d.py From megaman with BSD 2-Clause "Simplified" License | 5 votes |
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]
Example #9
Source File: covar_plotter3.py From megaman with BSD 2-Clause "Simplified" License | 5 votes |
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' ) )
Example #10
Source File: kendall_triangles.py From lddmm-ot with MIT License | 5 votes |
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)
Example #11
Source File: surface_of_revolution.py From lddmm-ot with MIT License | 5 votes |
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)