当前位置: 首页>>代码示例>>Python>>正文


Python mplot3d.Axes3D方法代码示例

本文整理汇总了Python中mpl_toolkits.mplot3d.Axes3D方法的典型用法代码示例。如果您正苦于以下问题:Python mplot3d.Axes3D方法的具体用法?Python mplot3d.Axes3D怎么用?Python mplot3d.Axes3D使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mpl_toolkits.mplot3d的用法示例。


在下文中一共展示了mplot3d.Axes3D方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: color_3D_projection

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def color_3D_projection(
        data_projection,
        variable_data,
        title,
        color_map='jet'):
    '''
    Plot a 3d scatter plot, each point being neural activity at a certain
    time bin, colored by the corresponding behavioral variable
    '''
    x, y, z = np.split(data_projection, 3, axis=1)
    fig = plt.figure(title[:3])
    ax = Axes3D(fig)
    p = ax.scatter(x, y, z, s=20, alpha=0.25, c=variable_data, cmap=color_map)
    fig.colorbar(p)
    ax.set_title(title, fontsize=18)
    plt.show()
    return ax 
开发者ID:int-brain-lab,项目名称:ibllib,代码行数:19,代码来源:dim_reduction.py

示例2: tryPlot

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def tryPlot():
    cmap = plt.get_cmap('jet_r')
    fig = plt.figure()
    ax = Axes3D(fig)
    draw(ax, [-0.0152730000000000,-0.113074400000000,0.00867852000000000,0.766616000000000,0.483920000000000,0.0964542000000000,
               8.65505000000000e-06,-0.000113369000000000,0.999997000000000,0.989706000000000,0.143116000000000,7.65900000000000e-06], cmap(float(1)/7))
    draw(ax, [-0.310188000000000,0.188456800000000,0.00978854000000000,0.596362000000000,0.577190000000000,0.141414800000000,
               -0.331254000000000,0.943525000000000,0.00456327000000000,-0.00484978000000000,-0.00653891000000000,0.999967000000000], cmap(float(2)/7))
    draw(ax, [-0.290236000000000,-0.334664000000000,-0.328648000000000,0.322898000000000,0.0585966000000000,0.0347996000000000,
               -0.330345000000000,-0.942455000000000,0.0514932000000000,0.0432524000000000,0.0393726000000000,0.998095000000000], cmap(float(3)/7))
    draw(ax, [-0.289462000000000,-0.334842000000000,0.361558000000000,0.322992000000000,0.0593536000000000,0.0350418000000000,
               0.309240000000000,0.949730000000000,0.0485183000000000,-0.0511885000000000,-0.0343219000000000,0.998099000000000], cmap(float(4)/7))
    draw(ax, [0.281430000000000,-0.306584000000000,0.382928000000000,0.392156000000000,0.0409424000000000,0.0348472000000000,
               0.322342000000000,-0.942987000000000,0.0828920000000000,-0.0248683000000000,0.0791002000000000,0.996556000000000], cmap(float(5)/7))
    draw(ax, [0.281024000000000,-0.306678000000000,-0.366110000000000,0.392456000000000,0.0409366000000000,0.0348446000000000,
               -0.322608000000000,0.942964000000000,0.0821142000000000,0.0256742000000000,-0.0780031000000000,0.996622000000000], cmap(float(6)/7))
    draw(ax, [0.121108800000000,-0.0146729400000000,0.00279166000000000,0.681576000000000,0.601756000000000,0.0959706000000000,
               -0.986967000000000,-0.160173000000000,0.0155341000000000,0.0146809000000000,0.00650174000000000,0.999801000000000], cmap(float(7)/7))
    plt.show() 
开发者ID:kevin-kaixu,项目名称:grass_pytorch,代码行数:21,代码来源:draw3dobb.py

示例3: showGenshapes

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def showGenshapes(genshapes):
    for i in range(len(genshapes)):
        recover_boxes = genshapes[i]

        fig = plt.figure(i)
        cmap = plt.get_cmap('jet_r')
        ax = Axes3D(fig)
        ax.set_xlim(-0.7, 0.7)
        ax.set_ylim(-0.7, 0.7)
        ax.set_zlim(-0.7, 0.7)

        for jj in range(len(recover_boxes)):
            p = recover_boxes[jj][:]
            draw(ax, p, cmap(float(jj)/len(recover_boxes)))

        plt.show() 
开发者ID:kevin-kaixu,项目名称:grass_pytorch,代码行数:18,代码来源:draw3dobb.py

示例4: tryPlot

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def tryPlot():
    cmap = plt.get_cmap(u'jet_r')
    fig = plt.figure()
    ax = Axes3D(fig)
    draw(ax, [-0.0152730000000000,-0.113074400000000,0.00867852000000000,0.766616000000000,0.483920000000000,0.0964542000000000,
               8.65505000000000e-06,-0.000113369000000000,0.999997000000000,0.989706000000000,0.143116000000000,7.65900000000000e-06], cmap(float(1)/7))
    draw(ax, [-0.310188000000000,0.188456800000000,0.00978854000000000,0.596362000000000,0.577190000000000,0.141414800000000,
               -0.331254000000000,0.943525000000000,0.00456327000000000,-0.00484978000000000,-0.00653891000000000,0.999967000000000], cmap(float(2)/7))
    draw(ax, [-0.290236000000000,-0.334664000000000,-0.328648000000000,0.322898000000000,0.0585966000000000,0.0347996000000000,
               -0.330345000000000,-0.942455000000000,0.0514932000000000,0.0432524000000000,0.0393726000000000,0.998095000000000], cmap(float(3)/7))
    draw(ax, [-0.289462000000000,-0.334842000000000,0.361558000000000,0.322992000000000,0.0593536000000000,0.0350418000000000,
               0.309240000000000,0.949730000000000,0.0485183000000000,-0.0511885000000000,-0.0343219000000000,0.998099000000000], cmap(float(4)/7))
    draw(ax, [0.281430000000000,-0.306584000000000,0.382928000000000,0.392156000000000,0.0409424000000000,0.0348472000000000,
               0.322342000000000,-0.942987000000000,0.0828920000000000,-0.0248683000000000,0.0791002000000000,0.996556000000000], cmap(float(5)/7))
    draw(ax, [0.281024000000000,-0.306678000000000,-0.366110000000000,0.392456000000000,0.0409366000000000,0.0348446000000000,
               -0.322608000000000,0.942964000000000,0.0821142000000000,0.0256742000000000,-0.0780031000000000,0.996622000000000], cmap(float(6)/7))
    draw(ax, [0.121108800000000,-0.0146729400000000,0.00279166000000000,0.681576000000000,0.601756000000000,0.0959706000000000,
               -0.986967000000000,-0.160173000000000,0.0155341000000000,0.0146809000000000,0.00650174000000000,0.999801000000000], cmap(float(7)/7))
    plt.show() 
开发者ID:kevin-kaixu,项目名称:grass_pytorch,代码行数:21,代码来源:draw3dobb.py

示例5: showGenshapes

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def showGenshapes(genshapes):
    for i in xrange(len(genshapes)):
        recover_boxes = genshapes[i]

        fig = plt.figure(i)
        cmap = plt.get_cmap(u'jet_r')
        ax = Axes3D(fig)
        ax.set_xlim(-0.7, 0.7)
        ax.set_ylim(-0.7, 0.7)
        ax.set_zlim(-0.7, 0.7)

        for jj in xrange(len(recover_boxes)):
            p = recover_boxes[jj][:]
            draw(ax, p, cmap(float(jj)/len(recover_boxes)))

        plt.show() 
开发者ID:kevin-kaixu,项目名称:grass_pytorch,代码行数:18,代码来源:draw3dobb.py

示例6: plot3d

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def plot3d(self, scale=0.32):
		r"""Plot 3d scatter plot of benchmark function.

		Args:
			scale (float): Scale factor for points.
		"""
		fig = plt.figure()
		ax = Axes3D(fig)
		func = self.function()
		Xr, Yr = arange(self.Lower, self.Upper, scale), arange(self.Lower, self.Upper, scale)
		X, Y = meshgrid(Xr, Yr)
		Z = vectorize(self.__2dfun)(X, Y, func)
		ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3)
		ax.contourf(X, Y, Z, zdir='z', offset=-10, cmap=cm.coolwarm)
		ax.set_xlabel('X')
		ax.set_ylabel('Y')
		ax.set_zlabel('Z')
		plt.show()

# vim: tabstop=3 noexpandtab shiftwidth=3 softtabstop=3 
开发者ID:NiaOrg,项目名称:NiaPy,代码行数:22,代码来源:benchmark.py

示例7: create_layout

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def create_layout(self, dimension: int) -> None:
        self.fig.canvas.set_window_title(self.plot_title)
        self.fig.suptitle(self.plot_title, fontsize=16)

        if dimension == 2:
            # Stylize axis
            self.ax.spines['top'].set_visible(False)
            self.ax.spines['right'].set_visible(False)
            self.ax.get_xaxis().tick_bottom()
            self.ax.get_yaxis().tick_left()
        elif dimension == 3:
            self.ax = Axes3D(self.fig)
            self.ax.autoscale(enable=True, axis='both')
        else:
            raise Exception('Dimension must be either 2 or 3')

        self.ax.set_autoscale_on(True)
        self.ax.autoscale_view(True, True, True)

        # Style options
        self.ax.grid(color='#f0f0f5', linestyle='-', linewidth=0.5, alpha=0.5) 
开发者ID:jMetal,项目名称:jMetalPy,代码行数:23,代码来源:streaming.py

示例8: plot3D_data

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def plot3D_data(data, x, y):
    X,Y = meshgrid(x,y)
    fig = plt.figure()
    ax = Axes3D(fig)
    #ax = fig.add_subplot(111, projection = "3d")
    ax.plot_surface(X, Y, data, rstride=1, cstride=1, cmap=cm.jet)

#def conditions_emitt_spread(screen):
#    if screen.ne ==1 and (screen.nx and screen.ny):
#        effect = 1
#    elif screen.ne ==1 and (screen.nx==1 and screen.ny):
#        effect = 2
#    elif screen.ne ==1 and (screen.nx and screen.ny == 1):
#        effect = 3
#    elif screen.ne >1 and (screen.nx == 1 and screen.ny == 1):
#        effect = 4
#    else:
#        effect = 0
#    return effect 
开发者ID:ocelot-collab,项目名称:ocelot,代码行数:21,代码来源:emitt_spread.py

示例9: compute_pca_plot_embedding

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def compute_pca_plot_embedding(eval_dir, z_train, z_test=None, save=True):
    sklearn_pca = PCA(n_components=3)
    full_z_pca = sklearn_pca.fit_transform(z_train)
    if z_test is not None:
        full_z_pca_test = sklearn_pca.transform(z_test)

    fig = plt.figure()
    ax = Axes3D(fig)

    c=np.linspace(0, 1, len(full_z_pca))
    ax.scatter(full_z_pca[:,0],full_z_pca[:,1],full_z_pca[:,2], c=c, marker='.', label='PCs of train viewsphere')
    if z_test is not None:
        ax.scatter(full_z_pca_test[:,0],full_z_pca_test[:,1],full_z_pca_test[:,2], c='red', marker='.', label='test_z')

    plt.title('Embedding Principal Components')
    ax.set_xlabel('pc1')
    ax.set_ylabel('pc2')
    ax.set_zlabel('pc3')

    plt.legend()
    pl.dump(fig,file(os.path.join(eval_dir,'figures','pca_embedding.pickle'),'wb'))
    if save:
        plt.savefig(os.path.join(eval_dir,'figures','pca_embedding.pdf')) 
开发者ID:DLR-RM,项目名称:AugmentedAutoencoder,代码行数:25,代码来源:eval_plots.py

示例10: scatter

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def scatter(self, ax, prop=None):
        """
        Plot scatter of data points on given axis

        Parameters
        ----------
        ax : AxesSubplot or Axes3DSubplot
            axis on which the scatter plot is drawn
        prop : str
            property to display with colormap
        """
        sc = None
        prop = self.property_name[0] if prop is None else prop

        if not self._2d and isinstance(ax, Axes3D):
            sc = ax.scatter(
                self.vr['x'], self.vr['y'], self.vr['z'],
                c=prop)
        else:
            sc = ax.scatter(
                self.vr['x'], self.vr['y'], c=prop)
        return sc 
开发者ID:whimian,项目名称:pyGeoStatistics,代码行数:24,代码来源:gslib_reader.py

示例11: fig_ax3d

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def fig_ax3d(clean=False, **kwds):
    """``fig,ax3d = fig_ax()``

    Parameters
    ----------
    clean : bool
        see :func:`clean_ax3d`
    """
    fig = plt.figure(**kwds)
    try:
        ax = fig.add_subplot(111, projection='3d')
    except:
        # mpl < 1.0.0
        ax = Axes3D(fig)
    if clean:
        clean_ax3d(ax)
    return fig, ax 
开发者ID:elcorto,项目名称:pwtools,代码行数:19,代码来源:mpl.py

示例12: plot_pc_old

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def plot_pc_old(pc_np, z_cutoff=70, birds_view=False, color='height', size=0.3, ax=None):
    # remove large z points
    valid_index = pc_np[:, 2] < z_cutoff
    pc_np = pc_np[valid_index, :]

    if ax is None:
        fig = plt.figure(figsize=(9, 9))
        ax = Axes3D(fig)
    if color == 'height':
        c = pc_np[:, 1]
        ax.scatter(pc_np[:, 0].tolist(), pc_np[:, 1].tolist(), pc_np[:, 2].tolist(), s=size, c=c, cmap=cm.jet_r)
    elif color == 'reflectance':
        assert False
    else:
        ax.scatter(pc_np[:, 0].tolist(), pc_np[:, 1].tolist(), pc_np[:, 2].tolist(), s=size, c=color)

    axisEqual3D(ax)
    if True == birds_view:
        ax.view_init(elev=0, azim=-90)
    else:
        ax.view_init(elev=-45, azim=-90)
    # ax.invert_yaxis()

    return ax 
开发者ID:lijx10,项目名称:USIP,代码行数:26,代码来源:vis_tools.py

示例13: test_visualization

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def test_visualization():
    ax = Axes3D(figure())
    # Without axis.
    ut.state_histogram(grove.tomography.operator_utils.GS, title="test")
    # With axis.
    ut.state_histogram(grove.tomography.operator_utils.GS, ax, "test")
    assert ax.get_title() == "test"

    ptX = grove.tomography.operator_utils.PAULI_BASIS.transfer_matrix(qt.to_super(
        grove.tomography.operator_utils.QX)).toarray()
    ax = Mock()
    with patch("matplotlib.pyplot.colorbar"):
        ut.plot_pauli_transfer_matrix(ptX, ax, grove.tomography.operator_utils.PAULI_BASIS.labels, "bla")
    assert ax.imshow.called
    assert ax.set_xlabel.called
    assert ax.set_ylabel.called 
开发者ID:rigetti,项目名称:grove,代码行数:18,代码来源:test_utils.py

示例14: __init__

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def __init__(self,  dim=2, parent=None):
        self.fig = Figure(figsize=(10, 10), dpi=100)
        self.dim = dim
        FigureCanvasQTAgg.__init__(self, self.fig)
        self.setParent(parent)
        FigureCanvasQTAgg.setSizePolicy(self, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        FigureCanvasQTAgg.updateGeometry(self)

        if dim==2:
            self.ax = self.fig.add_subplot(111)
            self.ax.figure.subplots_adjust(left=0.08, right=0.98, bottom=0.08, top=0.92)

        else:
            self.ax = Axes3D(self.fig)
            self.ax.mouse_init(rotate_btn=1, zoom_btn=2)

        FigureCanvasQTAgg.setSizePolicy(self, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        FigureCanvasQTAgg.updateGeometry(self) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:20,代码来源:plot.py

示例15: MyPlot_surface

# 需要导入模块: from mpl_toolkits import mplot3d [as 别名]
# 或者: from mpl_toolkits.mplot3d import Axes3D [as 别名]
def MyPlot_surface(self, lineNumber, data, stepX, stepY):
        ''' stepX = 2  # 采样步长 X
            stepY = 10  # 采样步长 Y
        '''
        # ax = self.figure.add_axes([0.05,0.05,0.9,0.9],projection='3d')
        # ax = Axes3D( self.figure )

        X = range(0, len(data), stepX)      #频率
        Y = range(0, len(data[0]), stepY)   #时间

        XX , YY= np.meshgrid(X, Y)  # XX[i]、YY[i]代表时间 ; XX[0][i]、YY[0][i]代表频率
        ZZ = np.zeros([len( Y ), len( X )])  # ZZ[i]代表时间、ZZ[0][i]代表频率

        for i in range(0, len( Y )):
            for j in range(0, len( X )):
                ZZ[i][j] = data[ X[j] ][ Y[i] ]

        # 具体函数方法可用 help(function) 查看,如:help(ax.plot_surface)
        self.axList[lineNumber].plot_surface(XX, YY, ZZ, rstride=1, cstride=1, cmap='rainbow')
        
        # self.canvas.draw() 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:23,代码来源:MyFigureCanvas.py


注:本文中的mpl_toolkits.mplot3d.Axes3D方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。