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


Python Axes.set_ylim方法代码示例

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


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

示例1: cla

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
    def cla(self):
        """Identical to Axes.cla (This docstring is overwritten)."""
        Axes.cla(self)

        # Set grid defaults...
        self.set_longitude_grid(10)
        self.set_latitude_grid(10)
        self.set_longitude_grid_ends(80)

        # Hide all ticks and tick labels for the "native" lon and lat axes
        self.xaxis.set_minor_locator(NullLocator())
        self.yaxis.set_minor_locator(NullLocator())
        self.xaxis.set_ticks_position('none')
        self.yaxis.set_ticks_position('none')
        self.xaxis.set_tick_params(label1On=False)
        self.yaxis.set_tick_params(label1On=False)

        # Set the grid on or off based on the rc params.
        self.grid(mpl.rcParams['axes.grid'])

        # Set the default limits (so that the "native" ticklabels will be
        # correct if they're turned back on)...
        Axes.set_xlim(self, -self.horizon, self.horizon)
        Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)

        # Set up the azimuth ticks.
        self._polar.set_theta_offset(np.radians(self.rotation + 90))
        self._polar.set_theta_direction(-1)
        self._polar.grid(False)
        self._polar.set_rticks([])
开发者ID:gravenimage,项目名称:mplstereonet,代码行数:32,代码来源:stereonet_axes.py

示例2: set_top_view

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
 def set_top_view(self):
     xdwl = (0.95/self.dist)
     xdw = (0.9/self.dist)
     ydwl = (0.95/self.dist)
     ydw = (0.9/self.dist)
     Axes.set_xlim(self, -xdwl, xdw)
     Axes.set_ylim(self, -ydwl, ydw)
开发者ID:,项目名称:,代码行数:9,代码来源:

示例3: plot_mods

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
def plot_mods(ax: Axes, stats: Stats, most_popular_at_bottom=False, percentage=False):
    # FIXME different colors when using percentage with 10 mods
    mods_by_popularity = sorted(stats.players_by_mod.keys(),
                                key=lambda mod: stats.all_time_players_by_mod[mod], reverse=most_popular_at_bottom)
    labels = ["{} - avg. {:.2f} players".format(mod, stats.all_time_players_by_mod[mod] / len(stats.dates))
              for mod in mods_by_popularity]

    colors = ['red', 'green', 'blue', 'yellow', 'purple', 'lime', 'gray', 'cyan', 'orange', 'deeppink', 'black']
    colors = colors[0:len(mods_by_popularity)]
    colors = colors if most_popular_at_bottom else reversed(colors)
    ax.set_prop_cycle(color=colors)

    all_mods_values = np.row_stack([stats.players_by_mod[mod] for mod in mods_by_popularity])
    if percentage:
        with np.errstate(invalid='ignore'):
            all_mods_values = all_mods_values / all_mods_values.sum(axis=0) * 100
    ax.stackplot(stats.dates, all_mods_values, labels=labels, linewidth=0.1)

    if percentage:
        ax.set_ylim(bottom=0, top=100)
    else:
        ax.set_ylim(bottom=0)
    decorate_axes(ax)
    handles, labels = ax.get_legend_handles_labels()
    handles = handles if most_popular_at_bottom else reversed(handles)
    labels = labels if most_popular_at_bottom else reversed(labels)
    leg = ax.legend(handles, labels, loc='upper left', prop={'size': 10})
    leg.get_frame().set_alpha(0.5)
开发者ID:martin-t,项目名称:xon-activity-stats,代码行数:30,代码来源:qstat-parser.py

示例4: cla

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
    def cla(self):
        """
        Override to set up some reasonable defaults.
        """
        # Don't forget to call the base class
        Axes.cla(self)

        # Set up a default grid spacing
        self.set_theta_grid(np.pi/4.)
        self.set_phi_grid(np.pi/2.)
        self.set_phi_grid_ends(np.pi/8.)

        # Turn off minor ticking altogether
        self.xaxis.set_minor_locator(NullLocator())
        self.yaxis.set_minor_locator(NullLocator())

        # Do not display ticks
        self.xaxis.set_ticks_position('none')
        self.yaxis.set_ticks_position('none')

        # The limits on this projection are fixed -- they are not to
        # be changed by the user.  This makes the math in the
        # transformation itself easier, and since this is a toy
        # example, the easier, the better.
        Axes.set_xlim(self, 0, np.pi)
        Axes.set_ylim(self, 0, 2 * np.pi)
开发者ID:amcmorl,项目名称:amcmorl-py-tools,代码行数:28,代码来源:split_lambert_projection.py

示例5: cla

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
    def cla(self):
        """
        Override to set up some reasonable defaults.
        """
        # Don't forget to call the base class
        Axes.cla(self)

        # Set up a default grid spacing
        self.set_longitude_grid(30)
        self.set_latitude_grid(15)
        self.set_longitude_grid_ends(75)

        # Turn off minor ticking altogether
        self.xaxis.set_minor_locator(NullLocator())
        self.yaxis.set_minor_locator(NullLocator())

        # Do not display ticks -- we only want gridlines and text
        self.xaxis.set_ticks_position("none")
        self.yaxis.set_ticks_position("none")

        # The limits on this projection are fixed -- they are not to
        # be changed by the user.  This makes the math in the
        # transformation itself easier, and since this is a toy
        # example, the easier, the better.
        Axes.set_xlim(self, -np.pi, np.pi)
        Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)
开发者ID:carlrose,项目名称:matplotlib,代码行数:28,代码来源:custom_projection_example.py

示例6: cla

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
    def cla(self):
        # Don't forget to call the base class
        Axes.cla(self)

        self._fancy_majorarcs = []
        self._normbox = None
        self._scale = self._get_key("axes.scale")
        self._current_zorder = self._get_key("plot.zorder")

        self.xaxis.set_major_locator(self.RealMaxNLocator(self, self._get_key("grid.major.xmaxn")))
        self.yaxis.set_major_locator(self.ImagMaxNLocator(self, self._get_key("grid.major.ymaxn")))

        self.xaxis.set_ticks_position('none')
        self.yaxis.set_ticks_position('none')

        Axes.set_xlim(self, 0, self._ax_lim_x * self._scale)
        Axes.set_ylim(self, -self._ax_lim_y * self._scale, self._ax_lim_y * self._scale)

        for label in self.get_xticklabels():
            label.set_verticalalignment('center')
            label.set_horizontalalignment('center')
            label.set_rotation(self._get_key("axes.xlabel.rotation"))
            label.set_bbox(self._get_key("axes.xlabel.fancybox"))
            self.add_artist(label)  # if not readded, labels are drawn behind grid

        for tick, loc in zip(self.yaxis.get_major_ticks(),
                             self.yaxis.get_majorticklocs()):
            # workaround for fixing to small infinity symbol
            if abs(loc) > self._near_inf * self._scale:
                tick.label.set_size(tick.label.get_size() +
                                    self._get_key("symbol.infinity.correction"))

            tick.label.set_verticalalignment('center')

            x = np.real(self._moebius_z(loc * 1j))
            if x < -0.1:
                tick.label.set_horizontalalignment('right')
            elif x > 0.1:
                tick.label.set_horizontalalignment('left')
            else:
                tick.label.set_horizontalalignment('center')

        self.yaxis.set_major_formatter(self.ImagFormatter(self))
        self.xaxis.set_major_formatter(self.RealFormatter(self))

        norm = self._get_key("axes.norm")
        if norm is not None:
            x, y = split_complex(self._moebius_inv_z(-1 - 1j))
            self._normbox = self.text(x, y, "Norm: %d\u2126" % norm)
            self._normbox.set_verticalalignment("center")

            px = self._get_key("ytick.major.pad")
            py = px + 0.5 * self._normbox.get_size()
            self._normbox.set_transform(self._yaxis_correction + \
                                        Affine2D().translate(-px, -py))

        self.grid(b=self._get_key("grid.major.enable"))
开发者ID:openchip,项目名称:red-pitaya-notes,代码行数:59,代码来源:smithaxes.py

示例7: set_top_view

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
    def set_top_view(self):
        # this happens to be the right view for the viewing coordinates
        # moved up and to the left slightly to fit labels and axes
        xdwl = (0.95/self.dist)
        xdw = (0.9/self.dist)
        ydwl = (0.95/self.dist)
        ydw = (0.9/self.dist)

        Axes.set_xlim(self, -xdwl, xdw, auto=None)
        Axes.set_ylim(self, -ydwl, ydw, auto=None)
开发者ID:CTPUG,项目名称:matplotlib,代码行数:12,代码来源:axes3d.py

示例8: plot_servers

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
def plot_servers(ax: Axes, stats: Stats):
    ax.plot_date(stats.dates, stats.active_servers, 'g')
    # ax.plot_date(stats.dates, stats.players_on_most_active_server, 'black')
    ax.plot_date(stats.dates, stats.avg_players_per_active_server, 'gray')

    ax.set_ylim(bottom=0)
    decorate_axes(ax)
    highlight_weekends(stats.dates, ax)
    leg = ax.legend(["Active servers", "Average humans per active server"], loc='upper left')
    leg.get_frame().set_alpha(0.5)
开发者ID:martin-t,项目名称:xon-activity-stats,代码行数:12,代码来源:qstat-parser.py

示例9: cla

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
 def cla(self):
     Axes.cla(self)
     self.set_longitude_grid(30)
     self.set_latitude_grid(15)
     self.set_longitude_grid_ends(75)
     self.xaxis.set_minor_locator(NullLocator())
     self.yaxis.set_minor_locator(NullLocator())
     self.xaxis.set_ticks_position('none')
     self.yaxis.set_ticks_position('none')
     self.grid(rcParams['axes.grid'])
     Axes.set_xlim(self, -np.pi, np.pi)
     Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)
开发者ID:,项目名称:,代码行数:14,代码来源:

示例10: plot_totals

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
def plot_totals(ax: Axes, stats: Stats):
    ax.plot_date(stats.dates, stats.total_servers, 'g')
    ax.plot_date(stats.dates, stats.total_human_players, 'black')
    ax.plot_date(stats.dates, stats.total_active_players, 'r')
    ax.plot_date(stats.dates, stats.total_spectators, 'orange')
    ax.plot_date(stats.dates, stats.total_bots, 'lime')

    ax.set_ylim(bottom=0)
    decorate_axes(ax)
    highlight_weekends(stats.dates, ax)
    leg = ax.legend(["Servers", "Human players", "Playing", "Spectating", "Bots"], loc='upper left')
    leg.get_frame().set_alpha(0.5)
开发者ID:martin-t,项目名称:xon-activity-stats,代码行数:14,代码来源:qstat-parser.py

示例11: plot_cross_cut

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
 def plot_cross_cut():
     #plot cut plane with crossection of cut fibers
     fig55 = figure(55)
     title('Cut fibers area (ellipses)')
     ax55 = Axes(fig55, [.1, .1, .8, .8])
     fig55.add_axes(ax55)
     for i in range(0, len(phi_x_cut)):
         sy_c = sy_cut[i] + (sec - sx_cut[i]) / cos(phi_x_cut[i]) * sin(phi_x_cut[i]) * cos(theta_cut[i])
         sz_c = sz_cut[i] + (sec - sx_cut[i]) / cos(phi_x_cut[i]) * sin(phi_x_cut[i]) * sin(theta_cut[i])
         if (0 < phi_x_cut[i] < arctan((fib.lf) / fib.df)) and (sx_cut[i] - fib.lf / 2. * cos(phi_x_cut[i]) + fib.df / 2. * sin(phi_x_cut[i]) < sec < sx_cut[i] + fib.lf / 2. * cos(phi_x_cut[i]) - fib.df / 2. * sin(phi_x_cut[i])):
             patch = Ellipse([ sy_c, sz_c ] , fib.df, fib.df / cos(phi_x_cut[i]), theta_cut[i] * 180 / pi , color = 'black')
             ax55.add_artist(patch)
     ax55.set_xlim(-spec.l_y / 2., spec.l_y / 2.)
     ax55.set_ylim(-spec.l_z / 2., spec.l_z / 2.)
开发者ID:kelidas,项目名称:scratch,代码行数:16,代码来源:specimen3D_fibers.py

示例12: cla

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
    def cla(self):
        Axes.cla(self)

        self.set_longitude_grid(30)
        self.set_latitude_grid(15)
        self.set_longitude_grid_ends(75)
        self.xaxis.set_minor_locator(NullLocator())
        self.yaxis.set_minor_locator(NullLocator())
        self.xaxis.set_ticks_position('none')
        self.yaxis.set_ticks_position('none')
        self.yaxis.set_tick_params(label1On=True)
        # Why do we need to turn on yaxis tick labels, but
        # xaxis tick labels are already on?

        self.grid(rcParams['axes.grid'])

        Axes.set_xlim(self, -np.pi, np.pi)
        Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)
开发者ID:adnanb59,项目名称:matplotlib,代码行数:20,代码来源:custom_projection_example.py

示例13: cla

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
    def cla(self):
        """
        Initialize the Axes object to reasonable defaults.
        """
        Axes.cla(self)

        self.set_longitude_grid(30)
        self.set_latitude_grid(15)
        self.set_longitude_grid_ends(75)
        self.xaxis.set_minor_locator(NullLocator())
        self.yaxis.set_minor_locator(NullLocator())
        self.xaxis.set_ticks_position('none')
        self.yaxis.set_ticks_position('none')

        # self.grid(rcParams['axes.grid'])

        Axes.set_xlim(self, -npy.pi, npy.pi)
        Axes.set_ylim(self, -npy.pi / 2.0, npy.pi / 2.0)
开发者ID:eddienko,项目名称:SamPy,代码行数:20,代码来源:custom_projection_example.py

示例14: display_image

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
 def display_image(self):
 
     # plot and save the image
     img = self.compute_image()
     
     # clear previous figure
     self.fig.clf()
     # setup plot 
     ax = Axes(self.fig, [0, 0, 1, 1]) # remove outer border  
     ax.set_axis_off()                 # disable axis
     ax.set_xlim((self.xmin, self.xmax))
     ax.set_ylim((self.ymin, self.ymax))
     ax.set_xticklabels([])
     ax.set_yticklabels([])
     ax.imshow(img, cmap=pl.get_cmap(self.cmap), interpolation='nearest', 
               extent=[self.xmin, self.xmax, self.ymin, self.ymax],
               origin='upper', aspect=1.0)
               
     self.fig.add_axes(ax)
开发者ID:TarasKuzyo,项目名称:python-fractals,代码行数:21,代码来源:julia-fractal.py

示例15: cla

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_ylim [as 别名]
    def cla(self):
        Axes.cla(self)

        self.set_longitude_grid(30)
        self.set_latitude_grid(10)
        self.set_longitude_grid_ends(89)
        self.set_latitude_grid_ends(89)
        self.xaxis.set_minor_locator(NullLocator())
        self.yaxis.set_minor_locator(NullLocator())
        self.xaxis.set_ticks_position('none')
        self.yaxis.set_ticks_position('none')
#        self.yaxis.set_tick_params(label1On=True)
        # Why do we need to turn on yaxis tick labels, but
        # xaxis tick labels are already on?

        self.grid(rcParams['axes.grid'])

        Axes.set_xlim(self, -180, 179.999)
#        Axes.set_ylim(self, -90, 90)
        Axes.set_ylim(self, -80, 80)
开发者ID:pelson,项目名称:mpl_mapping_trial,代码行数:22,代码来源:custom_projection.py


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