Python plotly.graph_objs.Surface() Examples

The following are 5 code examples of plotly.graph_objs.Surface(). 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: plot.py    From sound_field_analysis-py with MIT License 6 votes vote down vote up
def genSphere(vizMTX):
    """ Returns trace of sphere with intensity as surface color

    Parameters
    ----------
    vizMTX : array_like
        Matrix holding spherical data for visualization

    Returns
    -------
    T : plotly_trace
        Trace of desired sphere
    """
    coords = genSphCoords()

    trace = go.Surface(
        x=coords.x,
        y=coords.y,
        z=coords.z,
        surfacecolor=_np.abs(vizMTX.reshape((181, -1))).T,
        colorscale='Viridis',
        showscale=False,
        hoverinfo='none'
    )
    return trace 
Example #2
Source File: surface_of_revolution.py    From lddmm-ot with MIT License 6 votes vote down vote up
def __init__(self, R, Rp, Rpp, Z, Zp, D, vis_mode='3D') :
		"""
		Creates a Surface (d=2) of Revolution from function handles.
		
		Arguments :
		R 	-- @(r,t) -> R(r,t), the distance to z-axis
		Rp	-- its first derivative
		Rpp	-- its second derivative
		Z 	-- elevation function
		Zp 	-- derivative of the elevation function
		D 	-- periodic domain bounds, [[min_r, max_r], [min_t, max_t]]
		"""
		g = lambda q : array([[1, 0], [0, R(q[0])**2]])
		RManifold.__init__(self, 2, g)
		self.D = D
		self.R = R 
		self.Rp = Rp
		self.Rpp = Rpp
		self.Z = Z
		self.Zp = Zp
		
		self.vis_mode = vis_mode
		self.upsample_trajs = False 
Example #3
Source File: plot.py    From sound_field_analysis-py with MIT License 5 votes vote down vote up
def genShape(vizMTX):
    """ Returns trace of shape with intensity as radial extension

    Parameters
    ----------
    vizMTX : array_like
        Matrix holding spherical data for visualization

    Returns
    -------
    T : plotly_trace
        Trace of desired shape

    TODO
    ----
    Fix camera position
    """
    V = sph2cartMTX(vizMTX)

    trace = go.Surface(
        x=V.xs,
        y=V.ys,
        z=V.zs,
        surfacecolor=_np.abs(vizMTX.reshape((181, -1))).T,
        colorscale='Viridis',
        showscale=False,
        hoverinfo='none'
    )
    return trace 
Example #4
Source File: plot.py    From sound_field_analysis-py with MIT License 5 votes vote down vote up
def genFlat(vizMTX):
    """ Returns trace of flat surface with intensity as surface elevation and color

    Parameters
    ----------
    vizMTX : array_like
        Matrix holding spherical data for visualization

    Returns
    -------
    T : plotly_trace
        Trace of desired surface

    TODO
    ----
    Fix orientation and axis limits
    """

    trace = go.Surface(
        x=_np.r_[0:360],
        y=_np.r_[0:181],
        z=_np.abs(vizMTX),
        surfacecolor=_np.abs(vizMTX.reshape((181, -1))),
        colorscale='Viridis',
        showscale=False,
        hoverinfo='none'
    )
    return trace 
Example #5
Source File: surface_of_revolution.py    From lddmm-ot with MIT License 5 votes vote down vote up
def show_3D(self) :
		r  = linspace(self.D[0,0],self.D[0,1], 45)
		th = linspace(self.D[1,0],self.D[1,1], 45)
		
		(R, TH) = meshgrid(r, th)
		b_foo = self.b
		self.b = 0.99*self.b
		(X,Y,Z) = self.I(R = R, Theta = TH)
		self.b = b_foo
		
		surface = go.Surface(x=X, y=Y, z=Z,
                    opacity = 0.99,
                    colorscale = [[0, 'rgb(255,100,0)'], [1, 'rgb(255,255,0)']],
                    autocolorscale = False,
                    showscale = False,
                    hoverinfo = "none",
                    contours = {'x' : {'highlight' : False, 'highlightwidth' : 1},
                                'y' : {'highlight' : False, 'highlightwidth' : 1}, 
                                'z' : {'highlight' : False, 'highlightwidth' : 1}}
                    )
		self.layout['scene']['aspectmode'] = 'cube'
		m = 1.2 * (self.a + self.b)
		self.layout['scene']['xaxis'] = dict( range = [-m, m] )
		self.layout['scene']['yaxis'] = dict( range = [-m, m] )
		self.layout['scene']['zaxis'] = dict( range = [-m, m] )
		self.current_axis.append(surface)