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


Python pyplot.yscale方法代码示例

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


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

示例1: hist_width

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def hist_width(d, i=0, bins=(0, 10, 0.025), pdf=True, weights=None,
               yscale='log', color=None, plot_style=None, vline=None):
    """Plot histogram of burst durations.

    Parameters:
        d (Data): Data object
        i (int): channel index
        bins (array or None): array of bin edges. If len(bins) == 3
            then is interpreted as (start, stop, step) values.
        pdf (bool): if True, normalize the histogram to obtain a PDF.
        color (string or tuple or None): matplotlib color used for the plot.
        yscale (string): 'log' or 'linear', sets the plot y scale.
        plot_style (dict): dict of matplotlib line style passed to `plot`.
        vline (float): If not None, plot vertical line at the specified x
            position.
    """
    weights = weights[i] if weights is not None else None
    burst_widths = d.mburst[i].width * d.clk_p * 1e3

    _hist_burst_taildist(burst_widths, bins, pdf, weights=weights, vline=vline,
                         yscale=yscale, color=color, plot_style=plot_style)
    plt.xlabel('Burst width (ms)')
    plt.xlim(xmin=0) 
开发者ID:tritemio,项目名称:FRETBursts,代码行数:25,代码来源:burst_plot.py

示例2: plot_train_loss

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def plot_train_loss(df=[], arr_list=[''], figname='training_loss.png'):

    fig, ax = plt.subplots(figsize=(16,10))
    for arr in arr_list:
        label = df[arr][0]
        vals = df[arr][1]
        epochs = range(0, len(vals))
        ax.plot(epochs, vals, label=r'%s'%(label))
    
    ax.set_xlabel('Epoch', fontsize=18)
    ax.set_ylabel('Loss', fontsize=18)
    ax.set_title('Training Loss', fontsize=24)
    ax.grid()
    #plt.yscale('log')
    plt.legend(loc='upper right', numpoints=1, fontsize=16)
    print(figname)
    plt.tight_layout()
    fig.savefig(figname) 
开发者ID:zhampel,项目名称:clusterGAN,代码行数:20,代码来源:plots.py

示例3: example1

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def example1():
    """
    Compute the GRADEV of a white phase noise. Compares two different 
    scenarios. 1) The original data and 2) ADEV estimate with gap robust ADEV.
    """
    N = 1000
    f = 1
    y = np.random.randn(1,N)[0,:]
    x = [xx for xx in np.linspace(1,len(y),len(y))]
    x_ax, y_ax, (err_l, err_h), ns = allan.gradev(y,data_type='phase',rate=f,taus=x)
    plt.errorbar(x_ax, y_ax,yerr=[err_l,err_h],label='GRADEV, no gaps')
    
    
    y[int(np.floor(0.4*N)):int(np.floor(0.6*N))] = np.NaN # Simulate missing data
    x_ax, y_ax, (err_l, err_h) , ns = allan.gradev(y,data_type='phase',rate=f,taus=x)
    plt.errorbar(x_ax, y_ax,yerr=[err_l,err_h], label='GRADEV, with gaps')
    plt.xscale('log')
    plt.yscale('log')
    plt.grid()
    plt.legend()
    plt.xlabel('Tau / s')
    plt.ylabel('Overlapping Allan deviation')
    plt.show() 
开发者ID:aewallin,项目名称:allantools,代码行数:25,代码来源:gradev-demo.py

示例4: _hist_burst_taildist

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def _hist_burst_taildist(data, bins, pdf, weights=None, yscale='log',
                         color=None, label=None, plot_style=None, vline=None):
    hist = HistData(*np.histogram(data[~np.isnan(data)],
                                  bins=_bins_array(bins), weights=weights))
    ydata = hist.pdf if pdf else hist.counts

    default_plot_style = dict(marker='o')
    if plot_style is None:
        plot_style = {}
    if color is not None:
        plot_style['color'] = color
    if label is not None:
        plot_style['label'] = label
    default_plot_style.update(_normalize_kwargs(plot_style, kind='line2d'))
    plt.plot(hist.bincenters, ydata, **default_plot_style)
    if vline is not None:
        plt.axvline(vline, ls='--')
    plt.yscale(yscale)
    if pdf:
        plt.ylabel('PDF')
    else:
        plt.ylabel('# Bursts') 
开发者ID:tritemio,项目名称:FRETBursts,代码行数:24,代码来源:burst_plot.py

示例5: hist_mrates

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def hist_mrates(d, i=0, m=10, bins=(0, 4000, 100), yscale='log', pdf=False,
                dense=True, plot_style=None):
    """Histogram of m-photons rates. See also :func:`hist_mdelays`.
    """
    ph = d.get_ph_times(ich=i)
    if dense:
        ph_mrates = 1.*m/((ph[m-1:]-ph[:ph.size-m+1])*d.clk_p*1e3)
    else:
        ph_mrates = 1.*m/(np.diff(ph[::m])*d.clk_p*1e3)

    hist = HistData(*np.histogram(ph_mrates, bins=_bins_array(bins)))
    ydata = hist.pdf if pdf else hist.counts
    plot_style_ = dict(marker='o')
    plot_style_.update(_normalize_kwargs(plot_style, kind='line2d'))
    plot(hist.bincenters, ydata, **plot_style_)
    gca().set_yscale(yscale)
    xlabel("Rates (kcps)")

## Bursts stats 
开发者ID:tritemio,项目名称:FRETBursts,代码行数:21,代码来源:burst_plot.py

示例6: test_markevery_log_scales

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def test_markevery_log_scales():
    cases = [None,
         8,
         (30, 8),
         [16, 24, 30], [0,-1],
         slice(100, 200, 3),
         0.1, 0.3, 1.5,
         (0.0, 0.1), (0.45, 0.1)]

    cols = 3
    gs = matplotlib.gridspec.GridSpec(len(cases) // cols + 1, cols)

    delta = 0.11
    x = np.linspace(0, 10 - 2 * delta, 200) + delta
    y = np.sin(x) + 1.0 + delta

    for i, case in enumerate(cases):
        row = (i // cols)
        col = i % cols
        plt.subplot(gs[row, col])
        plt.title('markevery=%s' % str(case))
        plt.xscale('log')
        plt.yscale('log')
        plt.plot(x, y, 'o', ls='-', ms=4,  markevery=case) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:26,代码来源:test_axes.py

示例7: diagnostic_plot

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def diagnostic_plot(x, values_and_labels=(), plotmodulus=False, ylog=True, title="diagnostic plot", xlabel="x", ylabel="y"): # {{{
    #try:
        plt.figure(figsize=(7,6))
        plotmin = None
        for value, label in values_and_labels:
            plt.plot(x, np.abs(value) if plotmodulus else value, label=label)
            if len(value)>0:
                if plotmin==None or plotmin > np.min(value):
                    plotmin = max(np.min(np.abs(value)), np.max(np.abs(value))/1e10)
        plt.legend(prop={'size':10}, loc='lower left')
        plt.xlabel(xlabel); plt.ylabel(ylabel); plt.title(title)
        if ylog and plotmin is not None: 
            plt.yscale("log")
            plt.ylim(bottom=plotmin) ## ensure reasonable extent of values of 10 orders of magnitude
        plt.savefig("%s.png" % title, bbox_inches='tight')
    #except:
        #meep.master_printf("Diagnostic plot %s failed with %s, computation continues" % (title, sys.exc_info()[0]))
# }}} 
开发者ID:FilipDominec,项目名称:python-meep-utils,代码行数:20,代码来源:meep_utils.py

示例8: draw

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def draw(x, y1, y2, y3, y4, y5, log, name, prefix, suffix, summariesdir):
    plt.figure(1, dpi=300)
    plt.plot(x, y2, label='Uninfected', color=colors['mblue'])
    plt.plot(x, y1, label='Infected', color=colors['lblue'])
    plt.plot(x, y3, label='Phage-producing', color=colors['blue'])
    plt.plot(x, y4, label='All E. coli', color=colors['fblue'])
    plt.plot(x, y5, label='Phage', color=colors['red'])

    plt.legend()
    logstr = ''
    if log:
        plt.yscale('log')
        logstr = '_log'

    plt.ylabel('c in Lagoon [cfu]/[pfu]')
    plt.title('Calculation of Concentrations during PREDCEL')
    plt.xlabel('Time [min]')

    plt.savefig(os.path.join(summariesdir, '{}{}_{}.png'.format(prefix, name, logstr, suffix)))
    plt.gcf().clear() 
开发者ID:igemsoftware2017,项目名称:AiGEM_TeamHeidelberg2017,代码行数:22,代码来源:predcel_plot.py

示例9: test_markevery_log_scales

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def test_markevery_log_scales():
    cases = [None,
             8,
             (30, 8),
             [16, 24, 30], [0, -1],
             slice(100, 200, 3),
             0.1, 0.3, 1.5,
             (0.0, 0.1), (0.45, 0.1)]

    cols = 3
    gs = matplotlib.gridspec.GridSpec(len(cases) // cols + 1, cols)

    delta = 0.11
    x = np.linspace(0, 10 - 2 * delta, 200) + delta
    y = np.sin(x) + 1.0 + delta

    for i, case in enumerate(cases):
        row = (i // cols)
        col = i % cols
        plt.subplot(gs[row, col])
        plt.title('markevery=%s' % str(case))
        plt.xscale('log')
        plt.yscale('log')
        plt.plot(x, y, 'o', ls='-', ms=4,  markevery=case) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:26,代码来源:test_axes.py

示例10: plot_cumulative_recall_differences

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def plot_cumulative_recall_differences(cumulative_recalls, path):
  """Plot differences in cumulative recall between groups up to time T."""
  plt.figure(figsize=(8, 3))
  style = {'dynamic': '-', 'static': '--'}

  for setting, recalls in cumulative_recalls.items():
    abs_array = np.mean(np.abs(recalls[0::2, :] - recalls[1::2, :]), axis=0)

    plt.plot(abs_array, style[setting], label=setting)

  plt.title(
      'Recall gap for EO agent in dynamic vs static environments', fontsize=16)
  plt.yscale('log')
  plt.xscale('log')
  plt.ylabel('TPR gap', fontsize=16)
  plt.xlabel('# steps', fontsize=16)
  plt.grid(True)
  plt.legend()
  plt.tight_layout()
  _write(path) 
开发者ID:google,项目名称:ml-fairness-gym,代码行数:22,代码来源:lending_plots.py

示例11: plot_forwardings

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def plot_forwardings(forwarding_events):
    """
    Plots a time series of the forwarding amounts.

    :param forwarding_events:
    """
    times = []
    amounts = []
    for f in forwarding_events:
        times.append(datetime.datetime.fromtimestamp(f['timestamp']))
        amounts.append(f['amt_in'])

    plt.xticks(rotation=45)
    plt.scatter(times, amounts, s=2)
    plt.yscale('log')
    plt.ylabel('Forwarding amount [sat]')
    plt.show() 
开发者ID:bitromortac,项目名称:lndmanage,代码行数:19,代码来源:example_fwding_summary.py

示例12: plot_fees

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def plot_fees(forwarding_events):
    """
    Plots forwarding fees and effective fee rate in color code.

    :param forwarding_events:
    """
    times = []
    amounts = []
    color = []
    for f in forwarding_events:
        times.append(datetime.datetime.fromtimestamp(f['timestamp']))
        amounts.append(f['fee_msat'])
        color.append(f['effective_fee'])
    plt.xticks(rotation=45)
    plt.scatter(times, amounts, c=color, norm=colors.LogNorm(vmin=1E-6, vmax=1E-3), s=2)
    plt.yscale('log')
    plt.ylabel('Fees [msat]')
    plt.ylim((0.5, 1E+6))
    plt.colorbar(label='effective feerate (base + rate)')
    plt.show() 
开发者ID:bitromortac,项目名称:lndmanage,代码行数:22,代码来源:example_fwding_summary.py

示例13: plot

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def plot(self, min_val=-10, max_val=10, step_size=0.1, figsize=(10, 5), xlabel=None, ylabel='Probability', xticks=None, yticks=None, log_xscale=False, log_yscale=False, file_name=None, show=True, fig=None, *args, **kwargs):
        if fig is None:
            if not show:
                mpl.rcParams['axes.unicode_minus'] = False
                plt.switch_backend('agg')
            fig = plt.figure(figsize=figsize)
            fig.tight_layout()
        xvals = np.arange(min_val, max_val, step_size)
        plt.plot(xvals, [torch.exp(self.log_prob(x)) for x in xvals], *args, **kwargs)
        if log_xscale:
            plt.xscale('log')
        if log_yscale:
            plt.yscale('log', nonposy='clip')
        if xticks is not None:
            plt.xticks(xticks)
        if yticks is not None:
            plt.xticks(yticks)
        # if xlabel is None:
        #     xlabel = self.name
        plt.xlabel(xlabel)
        plt.ylabel(ylabel)
        if file_name is not None:
            plt.savefig(file_name)
        if show:
            plt.show() 
开发者ID:pyprob,项目名称:pyprob,代码行数:27,代码来源:distribution.py

示例14: test_ioworker_performance

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def test_ioworker_performance(nvme0n1):
    import matplotlib.pyplot as plt

    output_io_per_second = []
    percentile_latency = dict.fromkeys([90, 99, 99.9, 99.99, 99.999])
    nvme0n1.ioworker(io_size=8,
                     lba_random=True,
                     read_percentage=100,
                     output_io_per_second=output_io_per_second,
                     output_percentile_latency=percentile_latency,
                     time=10).start().close()
    logging.info(output_io_per_second)
    logging.info(percentile_latency)

    X = []
    Y = []
    for _, k in enumerate(percentile_latency):
        X.append(k)
        Y.append(percentile_latency[k])

    plt.plot(X, Y)
    plt.xscale('log')
    plt.yscale('log')
    #plt.show() 
开发者ID:pynvme,项目名称:pynvme,代码行数:26,代码来源:test_examples.py

示例15: test_replay_pynvme_trace

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import yscale [as 别名]
def test_replay_pynvme_trace(nvme0, nvme0n1, accelerator=1.0):
    filename = sg.PopupGetFile('select the trace file to replay', 'pynvme')
    if filename:
        logging.info(filename)

        # format before replay
        nvme0n1.format(512)
        
        responce_time = [0]*1000000
        replay_logfile(filename, nvme0n1, nvme0.mdts, accelerator, responce_time)

        import matplotlib.pyplot as plt
        plt.plot(responce_time)
        plt.xlabel('useconds')
        plt.ylabel('# IO')
        plt.xlim(1, len(responce_time))
        plt.ylim(bottom=1)
        plt.xscale('log')
        plt.yscale('log')
        plt.title(filename)
        plt.tight_layout()

        plt.show() 
开发者ID:pynvme,项目名称:pynvme,代码行数:25,代码来源:test_replayer.py


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