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


Python Axes3D.mouse_init方法代码示例

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


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

示例1: addmpl

# 需要导入模块: from mpl_toolkits.mplot3d import Axes3D [as 别名]
# 或者: from mpl_toolkits.mplot3d.Axes3D import mouse_init [as 别名]
 def addmpl(self, fig):
   self.fig = fig
   self.canvas = FigureCanvas(fig)
   self.mplvl.addWidget(self.canvas)
   self.canvas.draw()
   self.toolbar = NavigationToolbar(self.canvas, 
                                    self.mplwindow, coordinates=True)
   self.mplvl.addWidget(self.toolbar)
   ax = fig.get_axes()[0]
   Axes3D.mouse_init(ax)
开发者ID:JensMunkHansen,项目名称:sofus,代码行数:12,代码来源:sofus.py

示例2: plot_3d

# 需要导入模块: from mpl_toolkits.mplot3d import Axes3D [as 别名]
# 或者: from mpl_toolkits.mplot3d.Axes3D import mouse_init [as 别名]
    def plot_3d(self, z_data, x_coverage, y_coverage, title=None, x_axis_label="X", y_axis_label="Y", z_axis_label="Z"):
        # 3D plotting is sort of a pain in the neck, and heavily dependent on data formatting.  This routine assumes that you are
        # providing the z height data as a two dimensional array array, and that the overall X and Y spans are
        # given, so the routine can automatically compute arrays comprising the X and Y positions.  If your data files contain the X and Y
        # positions explicitly, this routine AND the data file reader will require heavy modification to ensure that the data gets
        # passed and plotted correctly.

        # takes Z data as an X by Y array of z values, and computes the X and Y arrays based on the "coverage" provided and the size
        # of the Z array

        # \todo design a better way of handling x and y coordinates
        # these might be passed as strings by the config parser, so ensure that they are recast as integers
        # \todo use configobj validators to handle this casting
        x_coverage = int(x_coverage)
        y_coverage = int(y_coverage)

        z_data = npy.array(z_data)

        self.clear_figure()
        # set up some borders
        # these borders never go away, and screw up the other plots - leave them out until a better way is found to elegently fix them
        # self.fig.subplots_adjust(left=0.05)
        # self.fig.subplots_adjust(right=0.95)
        # self.fig.subplots_adjust(top=0.97)
        # self.fig.subplots_adjust(bottom = 0.03)

        axes = self.fig.add_subplot(111, projection="3d")

        # allow us to use the mouse to spin the 3d plot around
        Axes3D.mouse_init(axes)

        (x_data, y_data) = compute_3d_coordinates(z_data, x_coverage, y_coverage)

        axes.plot_wireframe(x_data, y_data, z_data)

        if title:
            axes.set_title(title)
        axes.set_xlabel(x_axis_label)
        axes.set_ylabel(y_axis_label)
        axes.set_zlabel(z_axis_label)

        axes.view_init(self.elev_3d, self.azim_3d)
        self.canvas.draw()

        self.current_plot_type = "3D"
开发者ID:jdavidheiser,项目名称:PyDataExplorer,代码行数:47,代码来源:matplot.py

示例3: __init__

# 需要导入模块: from mpl_toolkits.mplot3d import Axes3D [as 别名]
# 或者: from mpl_toolkits.mplot3d.Axes3D import mouse_init [as 别名]
    def __init__(self, data_file, 
                data_type = 2,
                color_map = 'jet',
                plot_label = "",
                time_zone = 0, 
                plot_max_freq = 30.0,
                run_quietly = False,
                save_file = '',
                parent = None):

        self.data_type = data_type
        self.data_file = VOAOutFile(data_file, \
                        time_zone=time_zone, \
                        data_type=self.data_type)

        self.image_defs = self.IMG_TYPE_DICT[self.data_type]
        
        #color_map = eval('P.cm.' + color_map)
    
        num_grp = self.data_file.get_number_of_groups()
        if num_grp < 2:
            md = Gtk.MessageDialog(parent, \
                Gtk.DialogFlags.MODAL,\
                Gtk.MessageType.ERROR, \
                Gtk.ButtonsType.CANCEL, \
                "There must be 2 groups or more")
            md.run()
            md.destroy()
            return
        plot_groups = list(range(0, num_grp))

        self.subplots = []
        number_of_subplots = len(plot_groups)
        
        matplotlib.rcParams['axes.edgecolor'] = 'gray'
        matplotlib.rcParams['axes.facecolor'] = 'white'
        matplotlib.rcParams['axes.grid'] = True
        matplotlib.rcParams['figure.facecolor'] = 'white'
        matplotlib.rcParams['legend.fancybox'] = True
        matplotlib.rcParams['legend.shadow'] = True
        matplotlib.rcParams['figure.subplot.hspace'] = 0.45
        matplotlib.rcParams['figure.subplot.wspace'] = 0.35
        matplotlib.rcParams['figure.subplot.right'] = 0.85
        colorbar_fontsize = 12
               
        self.main_title_fontsize = 24
        matplotlib.rcParams['legend.fontsize'] = 12
        matplotlib.rcParams['axes.labelsize'] = 12
        matplotlib.rcParams['axes.titlesize'] = 10
        matplotlib.rcParams['xtick.labelsize'] = 10
        matplotlib.rcParams['ytick.labelsize'] = 10
        self.x_axes_ticks = np.arange(0, 25, 2)

        self.fig = Figure()
        ax = Axes3D(self.fig)
        
        X = np.arange(0, 25)
        Y = np.arange(0, len(plot_groups))
        X, Y = np.meshgrid(X, Y)

        data_buffer = [] # hold the Z data sets


        for chan_grp in plot_groups:
            (group_name, group_info, fot, muf, hpf, image_buffer) = \
                self.data_file.get_group_data(chan_grp)
            # Copy the element at [0] to the tail of the array 
            #to 'wrap-around' the values at 24hrs.
            np.resize(muf, len(muf)+1)
            muf[-1] = muf[0]
            data_buffer.append(muf)

        Z = np.vstack((tuple(data_buffer)))

	# set up the titles and labels
        ax.set_xticks(np.arange(0, 25, 2))

        if (plot_max_freq==self.AUTOSCALE) :
            z_max = math.ceil(max(muf) / 5.0) * 5.0
            z_max = min(plot_max_freq, 30.0)
            z_max = max(plot_max_freq, 5.0)
        else :
            z_max = math.ceil(plot_max_freq / 5.0) * 5.0
        z_ticks = [2, 5]
        for z_tick_value in np.arange(10, z_max+1, 5):
            z_ticks.append(z_tick_value) 
        #ax.set_yticks(z_ticks)

	#label axes
        tz_sign = '+' if (time_zone >= 0) else ''
        self.x_label = ax.set_xlabel('Time (UTC%s%s)' % (tz_sign, time_zone))
        self.y_label = ax.set_ylabel('Group')
        self.z_label = ax.set_zlabel('Frequency (MHz)')

	#do the plot
        ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=color_map)
        canvas = FigureCanvasGTK3Agg(self.fig)
        canvas.show()
        Axes3D.mouse_init(ax)
        VOAPlotWindow('pythonProp - ' + self.image_defs['title'], \
#.........这里部分代码省略.........
开发者ID:jawatson,项目名称:pythonprop,代码行数:103,代码来源:voa3DPlot.py

示例4: on_calc_done

# 需要导入模块: from mpl_toolkits.mplot3d import Axes3D [as 别名]
# 或者: from mpl_toolkits.mplot3d.Axes3D import mouse_init [as 别名]
    self.pool.start(worker)

    
  def on_calc_done(self,task):
    self.canvas1.draw()
    self.progressBar.setValue(100)
    self.btnField.setEnabled(True)
                                  

    
if __name__ == '__main__':

  fig = Figure()
  ax = fig.add_subplot(111, projection='3d')
  #fig.tight_layout()
  Axes3D.mouse_init(ax)

  fig1 = Figure()
  ax1 = fig1.add_subplot(111)
  #fig1.tight_layout()

  app = QtGui.QApplication(sys.argv)
  app.setStyle(QtGui.QStyleFactory.create('Fusion'))
  main = Main()
  main.addmpl(fig)
  main.addfield(fig1)
  main.show()
  sys.exit(app.exec_())


# In Qt 5.2, we can do
开发者ID:JensMunkHansen,项目名称:sofus,代码行数:33,代码来源:sofus.py


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