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


Python Axes.grid方法代码示例

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


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

示例1: grid

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import grid [as 别名]
    def grid(self, b=None, which='major', axis='both', **kwargs):
        Axes.grid(self, b, which, axis, **kwargs)

        plot_handler = GlobalFigureManager.get_active_figure().plot_handler
        if plot_handler is not None and not is_gui():
            if axis == 'x':
                plot_handler.manager._xgrid = b
            elif axis == 'y':
                plot_handler.manager._ygrid = b
开发者ID:mantidproject,项目名称:mslice,代码行数:11,代码来源:__init__.py

示例2: grid

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import grid [as 别名]
    def grid(self, b=None, which='major', axis='both', kind='arbitrary',
             center=None, **kwargs):
        """
        Usage is identical to a normal axes grid except for the ``kind`` and
        ``center`` kwargs.  ``kind="polar"`` will add a polar overlay.

        The ``center`` and ``kind`` arguments allow you to add a grid from a
        differently-centered stereonet. This is useful for making "polar
        stereonets" that still use the same coordinate system as a standard
        stereonet.  (i.e. a plane/line/whatever will have the same
        representation on both, but the grid is displayed differently.)

        To display a polar grid on a stereonet, use ``kind="polar"``.

        It is also often useful to display a grid relative to an arbitrary
        measurement (e.g. a lineation axis).  In that case, use the
        ``lon_center`` and ``lat_center`` arguments.  Note that these are in
        radians in "stereonet coordinates".  Therefore, you'll often want to
        use one of the functions in ``stereonet_math`` to convert a
        line/plane/rake into the longitude and latitude you'd input here. For
        example:  ``add_overlay(center=stereonet_math.line(plunge, bearing))``.

        If no parameters are specified, this is equivalent to turning on the
        standard grid.
        """
        grid_on = self._gridOn
        Axes.grid(self, False)

        if kind == 'polar':
            center = 0, 0

        if self._overlay_axes is not None:
            self._overlay_axes.remove()
            self._overlay_axes = None

        if not b and b is not None:
            return

        if b is None:
            if grid_on:
                return

        if center is None or np.allclose(center, (np.pi/2, 0)):
            return Axes.grid(self, b, which, axis, **kwargs)

        self._add_overlay(center)
        self._overlay_axes.grid(True, which, axis, **kwargs)
        self._gridOn = True
开发者ID:joferkington,项目名称:mplstereonet,代码行数:50,代码来源:stereonet_axes.py

示例3: drawEP

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import grid [as 别名]
def drawEP(fig, n, roundN, endowments, prices):
    ax = Axes(fig, [.1, .55, .8, .35])
    ax.grid(True)
    ax.set_xticks( range(roundN+1) )
    ax.set_frame_on(False)

    users = [[] for i in range(n)]
    for i in range(n):
        for j in range(roundN):
            users[i].append( float(Fraction(endowments[j][i])) )
        users[i].append( float(Fraction(prices[roundN-1][i])) )

    x = range(roundN+1)
    for i in range(n):
        price = round(float(Fraction(prices[roundN-1][i])), 3)
        ax.plot(x, users[i], linestyle = '--', marker = 'o', label = str(i) + ": " + str(price))
#    ax.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=2, ncol=min(n, 5), mode="expand", borderaxespad=0.)
    ax.legend()

    fig.add_axes( ax )
开发者ID:iSuneast,项目名称:Market,代码行数:22,代码来源:makeLog.py

示例4: draw

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import grid [as 别名]

#.........这里部分代码省略.........
        ax_plot_rect = ( float( plot_left_padding + left + delta / 2. ) / f_width,
                         float( plot_bottom_padding + bottom ) / f_height,
                         float( width - plot_left_padding - delta ) / f_width,
                         float( height - plot_bottom_padding - plot_title_size - 2 * plot_title_padding ) / f_height )
      ax.set_position( ax_plot_rect )


    self.figure.add_axes( ax )
    self.ax = ax
    frame = ax.patch
    frame.set_fill( False )

    if frame_flag.lower() == 'off':
      self.ax.set_axis_off()
      self.log_xaxis = False
      self.log_yaxis = False
    else:
      # If requested, make x/y axis logarithmic
      if prefs.get( 'log_xaxis', 'False' ).find( 'r' ) >= 0:
        ax.semilogx()
        self.log_xaxis = True
      else:
        self.log_xaxis = False
      if prefs.get( 'log_yaxis', 'False' ).find( 'r' ) >= 0:
        ax.semilogy()
        self.log_yaxis = True
      else:
        self.log_yaxis = False

      if xticks_flag:
        setp( ax.get_xticklabels(), family = prefs['font_family'] )
        setp( ax.get_xticklabels(), fontname = prefs['font'] )
        setp( ax.get_xticklabels(), size = tick_text_size_point )
      else:
        setp( ax.get_xticklabels(), size = 0 )

      if yticks_flag:
        setp( ax.get_yticklabels(), family = prefs['font_family'] )
        setp( ax.get_yticklabels(), fontname = prefs['font'] )
        setp( ax.get_yticklabels(), size = tick_text_size_point )
      else:
        setp( ax.get_yticklabels(), size = 0 )

      setp( ax.get_xticklines(), markeredgewidth = pixelToPoint( 0.5, dpi ) )
      setp( ax.get_xticklines(), markersize = pixelToPoint( text_size / 2., dpi ) )
      setp( ax.get_yticklines(), markeredgewidth = pixelToPoint( 0.5, dpi ) )
      setp( ax.get_yticklines(), markersize = pixelToPoint( text_size / 2., dpi ) )
      setp( ax.get_xticklines(), zorder = 4.0 )

      line_width = prefs.get( 'line_width', 1.0 )
      frame_line_width = prefs.get( 'frame_line_width', line_width )
      grid_line_width = prefs.get( 'grid_line_width', 0.1 )
      plot_line_width = prefs.get( 'plot_line_width', 0.1 )

      setp( ax.patch, linewidth = pixelToPoint( plot_line_width, dpi ) )
      #setp( ax.spines, linewidth=pixelToPoint(frame_line_width,dpi) )
      #setp( ax.axvline(), linewidth=pixelToPoint(1.0,dpi) )
      axis_grid_flag = prefs.get( 'plot_axis_grid', True )
      if axis_grid_flag:
        ax.grid( True, color = '#555555', linewidth = pixelToPoint( grid_line_width, dpi ) )

      plot_axis_flag = prefs.get( 'plot_axis', True )
      if plot_axis_flag:
      # Set labels
        if xlabel:
          t = ax.set_xlabel( xlabel )
          t.set_family( prefs['font_family'] )
          t.set_fontname( prefs['font'] )
          t.set_size( label_text_size )

        if ylabel:
          t = ax.set_ylabel( ylabel )
          t.set_family( prefs['font_family'] )
          t.set_fontname( prefs['font'] )
          t.set_size( label_text_size )
      else:
        self.ax.set_axis_off()


    # Create a plot title, if necessary
    if plot_title:
      self.ax.title = self.ax.text( 0.5,
                                    1. + float( plot_title_padding ) / height,
                                    plot_title,
                                    verticalalignment = 'bottom',
                                    horizontalalignment = 'center',
                                    size = pixelToPoint( plot_title_size, dpi ),
                                    family = prefs['font_family'],
                                    fontname = prefs['font'])
      self.ax.title.set_transform( self.ax.transAxes )
      self.ax.title.set_family( prefs['font_family'] )
      self.ax.title.set_fontname( prefs['font'] )
    if stats_line:
      self.ax.stats = self.ax.text( 0.5, ( -stats_line_space ) / height,
                                    stats_line,
                                    verticalalignment = 'top',
                                    horizontalalignment = 'center',
                                    size = pixelToPoint( stats_line_size, dpi ) )

      self.ax.stats.set_transform( self.ax.transAxes )
开发者ID:DIRACGrid-test,项目名称:DIRAC,代码行数:104,代码来源:PlotBase.py


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