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


Python pyplot.autoscale方法代码示例

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


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

示例1: test_use_sticky_edges

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def test_use_sticky_edges():
    fig, ax = plt.subplots()
    ax.imshow([[0, 1], [2, 3]], origin='lower')
    assert_allclose(ax.get_xlim(), (-0.5, 1.5))
    assert_allclose(ax.get_ylim(), (-0.5, 1.5))
    ax.use_sticky_edges = False
    ax.autoscale()
    xlim = (-0.5 - 2 * ax._xmargin, 1.5 + 2 * ax._xmargin)
    ylim = (-0.5 - 2 * ax._ymargin, 1.5 + 2 * ax._ymargin)
    assert_allclose(ax.get_xlim(), xlim)
    assert_allclose(ax.get_ylim(), ylim)
    # Make sure it is reversible:
    ax.use_sticky_edges = True
    ax.autoscale()
    assert_allclose(ax.get_xlim(), (-0.5, 1.5))
    assert_allclose(ax.get_ylim(), (-0.5, 1.5)) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:18,代码来源:test_axes.py

示例2: full_frame

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def full_frame(plt, width=0.64, height=0.64):
    r"""
    Generates a particular tight layout for Pyplot plots

    :param plt: pyplot
    :param width: width, default is 64 pixels
    :param height: height, default is 64 pixels
    :return:
    """
    import matplotlib as mpl
    mpl.rcParams['savefig.pad_inches'] = 0
    figsize = None if width is None else (width, height)
    fig = plt.figure(figsize=figsize)
    ax = plt.axes([0, 0, 1, 1], frameon=False)
    ax.get_xaxis().set_visible(False)
    ax.get_yaxis().set_visible(False)
    plt.autoscale(tight=True) 
开发者ID:davide-belli,项目名称:generative-graph-transformer,代码行数:19,代码来源:utils.py

示例3: full_frame_high_res

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def full_frame_high_res(plt, width=3.2, height=3.2):
    r"""
    Generates a particular tight layout for Pyplot plots, at higher resolution
    
    :param plt: pyplot
    :param width: width, default is 320 pixels
    :param height: height, default is 320 pixels
    :return:
    """
    import matplotlib as mpl
    mpl.rcParams['savefig.pad_inches'] = 0
    figsize = None if width is None else (width, height)
    fig = plt.figure(figsize=figsize)
    ax = plt.axes([0, 0, 1, 1], frameon=False)
    ax.get_xaxis().set_visible(False)
    ax.get_yaxis().set_visible(False)
    plt.autoscale(tight=True) 
开发者ID:davide-belli,项目名称:generative-graph-transformer,代码行数:19,代码来源:utils.py

示例4: pos_analysis

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def pos_analysis(data):
    """
    Analyze position.
    """
    tmerc_map = mapping.create_map(data.GPS_Lon.values, data.GPS_Lat.values)
    gps_y, gps_x = tmerc_map(data.GPS_Lon.values, data.GPS_Lat.values)
    gpos_y, gpos_x = tmerc_map(data.GPOS_Lon.values, data.GPOS_Lat.values)
    gpsp_y, gpsp_x = tmerc_map(
        data.GPSP_Lon[np.isfinite(data.GPSP_Lon.values)].values,
        data.GPSP_Lat[np.isfinite(data.GPSP_Lat.values)].values)

    import matplotlib.pyplot as plt
    plt.plot(gpos_y, gpos_x, '.', label='est')

    plt.plot(gps_y, gps_x, 'x', label='GPS')

    plt.plot(gpsp_y, gpsp_x, 'ro', label='cmd')

    plt.xlabel('E, m')
    plt.ylabel('N, m')
    plt.grid()
    plt.autoscale(True, 'both', True)
    plt.legend(loc='best')
    return locals() 
开发者ID:dronecrew,项目名称:px4tools,代码行数:26,代码来源:analysis.py

示例5: plot_subimage

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def plot_subimage(self, img, ax=None, show=True, fontsize=10):
        # img: {'actual', 'expected', 'gamma'}
        if ax is None:
            ax = plt.subplot()
        ax.tick_params(axis='both', labelsize=8)
        if img in ('actual', 'expected'):
            title = img.capitalize() + ' Fluence'
            plt.imshow(getattr(self.fluence, img).array.astype(np.float32), aspect='auto', interpolation='none',
                       cmap=get_array_cmap())
        elif img == 'gamma':
            plt.imshow(getattr(self.fluence, img).array.astype(np.float32), aspect='auto', interpolation='none', vmax=1,
                       cmap=get_array_cmap())
            plt.colorbar(ax=ax)
            title = 'Gamma Map'
        ax.autoscale(tight=True)
        ax.set_title(title, fontsize=fontsize)
        if show:
            plt.show() 
开发者ID:jrkerns,项目名称:pylinac,代码行数:20,代码来源:log_analyzer.py

示例6: plot_profiles

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def plot_profiles(self, axis=None):
        """Plot the horizontal and vertical profiles of the Uniformity slice.

        Parameters
        ----------
        axis : None, matplotlib.Axes
            The axis to plot on; if None, will create a new figure.
        """
        if axis is None:
            fig, axis = plt.subplots()
        horiz_data = self.image[int(self.phan_center.y), :]
        vert_data = self.image[:, int(self.phan_center.x)]
        axis.plot(horiz_data, 'g', label='Horizontal')
        axis.plot(vert_data, 'b', label='Vertical')
        axis.autoscale(tight=True)
        axis.axhline(self.tolerance, color='r', linewidth=3)
        axis.axhline(-self.tolerance, color='r', linewidth=3)
        axis.grid(True)
        axis.set_ylabel("HU")
        axis.legend(loc=8, fontsize='small', title="")
        axis.set_title("Uniformity Profiles") 
开发者ID:jrkerns,项目名称:pylinac,代码行数:23,代码来源:ct.py

示例7: plot_models

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def plot_models(x, y, models, fname, mx=None, ymax=None, xmin=None):

    plt.figure(num=None, figsize=(8, 6))
    plt.clf()
    plt.scatter(x, y, s=10)
    plt.title("Web traffic over the last month")
    plt.xlabel("Time")
    plt.ylabel("Hits/hour")
    plt.xticks(
        [w * 7 * 24 for w in range(10)], ['week %i' % w for w in range(10)])

    if models:
        if mx is None:
            mx = sp.linspace(0, x[-1], 1000)
        for model, style, color in zip(models, linestyles, colors):
            # print "Model:",model
            # print "Coeffs:",model.coeffs
            plt.plot(mx, model(mx), linestyle=style, linewidth=2, c=color)

        plt.legend(["d=%i" % m.order for m in models], loc="upper left")

    plt.autoscale(tight=True)
    plt.ylim(ymin=0)
    if ymax:
        plt.ylim(ymax=ymax)
    if xmin:
        plt.xlim(xmin=xmin)
    plt.grid(True, linestyle='-', color='0.75')
    plt.savefig(fname)

# first look at the data 
开发者ID:PacktPublishing,项目名称:Building-Machine-Learning-Systems-With-Python-Second-Edition,代码行数:33,代码来源:analyze_webstats.py

示例8: test_autoscale_tight

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def test_autoscale_tight():
    fig, ax = plt.subplots(1, 1)
    ax.plot([1, 2, 3, 4])
    ax.autoscale(enable=True, axis='x', tight=False)
    ax.autoscale(enable=True, axis='y', tight=True)
    assert_allclose(ax.get_xlim(), (-0.15, 3.15))
    assert_allclose(ax.get_ylim(), (1.0, 4.0)) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:9,代码来源:test_axes.py

示例9: test_autoscale_log_shared

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def test_autoscale_log_shared():
    # related to github #7587
    # array starts at zero to trigger _minpos handling
    x = np.arange(100, dtype=float)
    fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True)
    ax1.loglog(x, x)
    ax2.semilogx(x, x)
    ax1.autoscale(tight=True)
    ax2.autoscale(tight=True)
    plt.draw()
    lims = (x[1], x[-1])
    assert_allclose(ax1.get_xlim(), lims)
    assert_allclose(ax1.get_ylim(), lims)
    assert_allclose(ax2.get_xlim(), lims)
    assert_allclose(ax2.get_ylim(), (x[0], x[-1])) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:17,代码来源:test_axes.py

示例10: generate_graph

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def generate_graph():
    with open('../../data/loadaverage.dat', 'r') as csvfile:
        data_source = csv.reader(csvfile, delimiter=' ', skipinitialspace=True)
        for row in data_source:
            # [0] column is a time column
            # Convert to datetime data type
            a = datetime.strptime((row[0]),'%H:%M:%S')
            x.append((a))
            # The remaining columns contain data
            m1.append(row[3])
            m5.append(row[4])
            m15.append(row[5])
    
    # Plot lines
    plt.plot(x,m1, label='1 min', color='g', antialiased=True)
    plt.plot(x,m5, label='5 min', color='r', antialiased=True)
    plt.plot(x,m15, label='15 min', color='b', antialiased=True)
    
    # Graph properties
    plt.xlabel('Time',fontstyle='italic')
    plt.ylabel('Load average',fontstyle='italic')
    plt.title('Load average graph')
    plt.grid(linewidth=0.4, antialiased=True)
    plt.legend(loc='upper center', bbox_to_anchor=(0.5, -0.15), ncol=2, fancybox=True, shadow=True)
    plt.autoscale(True)
    
    # Graph saved to PNG file
    plt.savefig('../../graphs/loadaverage.png', bbox_inches='tight')
    #plt.show()

# ======================
# MAIN
# ====================== 
开发者ID:juliojsb,项目名称:sarviewer,代码行数:35,代码来源:loadaverage.py

示例11: generate_graph

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def generate_graph():
    with open('../../data/ram.dat', 'r') as csvfile:
        data_source = csv.reader(csvfile, delimiter=' ', skipinitialspace=True)
        for row in data_source:
            # [0] column is a time column
            # Convert to datetime data type
            a = datetime.strptime((row[0]),'%H:%M:%S')
            x.append((a))
            # The remaining columns contain data
            free_mem.append(str((int(row[1])/1024)+(int(row[4])/1024)+(int(row[5])/1024)))
            used_mem.append(str((int(row[2])/1024)-(int(row[4])/1024)-(int(row[5])/1024)))
            buffer_mem.append(str(int(row[4])/1024))
            cached_mem.append(str(int(row[5])/1024))
    
    # Plot lines
    plt.plot(x,free_mem, label='Free', color='g', antialiased=True)
    plt.plot(x,used_mem, label='Used', color='r', antialiased=True)
    plt.plot(x,buffer_mem, label='Buffer', color='b', antialiased=True)
    plt.plot(x,cached_mem, label='Cached', color='c', antialiased=True)
    
    # Graph properties
    plt.xlabel('Time',fontstyle='italic')
    plt.ylabel('Memory (MB)',fontstyle='italic')
    plt.title('RAM usage graph')
    plt.grid(linewidth=0.4, antialiased=True)
    plt.legend(loc='upper center', bbox_to_anchor=(0.5, -0.15), ncol=2, fancybox=True, shadow=True)
    plt.autoscale(True)
    
    # Graph saved to PNG file
    plt.savefig('../../graphs/ram.png', bbox_inches='tight')
    #plt.show()

# ======================
# MAIN
# ====================== 
开发者ID:juliojsb,项目名称:sarviewer,代码行数:37,代码来源:ram.py

示例12: generate_graph

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def generate_graph():
    with open('../../data/swap.dat', 'r') as csvfile:
        data_source = csv.reader(csvfile, delimiter=' ', skipinitialspace=True)
        for row in data_source:
            # [0] column is a time column
            # Convert to datetime data type
            a = datetime.strptime((row[0]),'%H:%M:%S')
            x.append((a))
            # The remaining columns contain data
            swap_free.append(str(int(row[1])/1024))
            swap_used.append(str(int(row[2])/1024))
            

    # Plot lines
    plt.plot(x,swap_used, label='Used', color='r', antialiased=True)
    plt.plot(x,swap_free, label='Free', color='g', antialiased=True)
    
    # Graph properties
    plt.xlabel('Time',fontstyle='italic')
    plt.ylabel('SWAP (MB)',fontstyle='italic')
    plt.title('SWAP usage graph')
    plt.grid(linewidth=0.4, antialiased=True)
    plt.legend(loc='upper center', bbox_to_anchor=(0.5, -0.15), ncol=2, fancybox=True, shadow=True)
    plt.autoscale(True)
    
    # Graph saved to PNG file
    plt.savefig('../../graphs/swap.png', bbox_inches='tight')
    #plt.show()

# ======================
# MAIN
# ====================== 
开发者ID:juliojsb,项目名称:sarviewer,代码行数:34,代码来源:swap.py

示例13: generate_graph

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def generate_graph():
    with open('../../data/proc.dat', 'r') as csvfile:
        data_source = csv.reader(csvfile, delimiter=' ', skipinitialspace=True)
        for row in data_source:
            # [0] column is a time column
            # Convert to datetime data type
            a = datetime.strptime((row[0]),'%H:%M:%S')
            x.append((a))
            # The remaining columns contain data
            procs_per_second.append(row[1])

    # Plot lines
    plt.plot(x,procs_per_second, label='Processes created per second', color='r', antialiased=True)
    
    # Graph properties
    plt.xlabel('Time',fontstyle='italic')
    plt.ylabel('Processes',fontstyle='italic')
    plt.title('Processes created per second graph')
    plt.grid(linewidth=0.4, antialiased=True)
    plt.legend(loc='upper center', bbox_to_anchor=(0.5, -0.15), ncol=2, fancybox=True, shadow=True)
    plt.autoscale(True)
    
    # Graph saved to PNG file
    plt.savefig('../../graphs/proc.png', bbox_inches='tight')
    #plt.show()

# ======================
# MAIN
# ====================== 
开发者ID:juliojsb,项目名称:sarviewer,代码行数:31,代码来源:proc.py

示例14: generate_graph

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def generate_graph():
    with open('../../data/loadaverage.dat', 'r') as csvfile:
        data_source = csv.reader(csvfile, delimiter=' ', skipinitialspace=True)
        for row in data_source:
            # [0] column is a time column
            # Convert to datetime data type
            a = datetime.strptime((row[0]),'%H:%M:%S')
            x.append((a))
            # The remaining columns contain data
            t_run_queue.append(row[1])
            t_total.append(row[2])
            t_blocked.append(row[6])
    
    # Plot lines
    plt.plot(x,t_run_queue, label='Tasks in run queue', color='g', antialiased=True)
    plt.plot(x,t_total, label='Total active tasks (processes + threads)', color='r', antialiased=True)
    plt.plot(x,t_blocked, label='Blocked tasks', color='m', antialiased=True)
    
    # Graph properties
    plt.xlabel('Time',fontstyle='italic')
    plt.ylabel('Tasks',fontstyle='italic')
    plt.title('Tasks graph')
    plt.grid(linewidth=0.4, antialiased=True)
    plt.legend(loc='upper center', bbox_to_anchor=(0.5, -0.15), ncol=2, fancybox=True, shadow=True)
    plt.autoscale(True)
    
    # Graph saved to PNG file
    plt.savefig('../../graphs/tasks.png', bbox_inches='tight')
    #plt.show()

# ======================
# MAIN
# ====================== 
开发者ID:juliojsb,项目名称:sarviewer,代码行数:35,代码来源:tasks.py

示例15: generate_graph

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import autoscale [as 别名]
def generate_graph():
    with open('../../data/netinterface.dat', 'r') as csvfile:
        data_source = csv.reader(csvfile, delimiter=' ', skipinitialspace=True)
        for row in data_source:
            # [0] column is a time column
            # Convert to datetime data type
            a = datetime.strptime((row[0]),'%H:%M:%S')
            x.append((a))
            # The remaining columns contain data
            r_kb.append(row[4])
            s_kb.append(row[5])
    
    # Plot lines
    plt.plot(x,r_kb, label='Kilobytes received per second', color='#009973', antialiased=True)
    plt.plot(x,s_kb, label='Kilobytes sent per second', color='#b3b300', antialiased=True)
    
    # Graph properties
    plt.xlabel('Time',fontstyle='italic')
    plt.ylabel('Kb/s',fontstyle='italic')
    plt.title('Network statistics')
    plt.grid(linewidth=0.4, antialiased=True)
    plt.legend(loc='upper center', bbox_to_anchor=(0.5, -0.18), ncol=2, fancybox=True, shadow=True)
    plt.autoscale(True)
    
    # Graph saved to PNG file
    plt.savefig('../../graphs/netinterface.png', bbox_inches='tight')
    #plt.show()

# ======================
# MAIN
# ====================== 
开发者ID:juliojsb,项目名称:sarviewer,代码行数:33,代码来源:netinterface.py


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