當前位置: 首頁>>代碼示例>>Python>>正文


Python seaborn.set方法代碼示例

本文整理匯總了Python中seaborn.set方法的典型用法代碼示例。如果您正苦於以下問題:Python seaborn.set方法的具體用法?Python seaborn.set怎麽用?Python seaborn.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在seaborn的用法示例。


在下文中一共展示了seaborn.set方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def __init__(self, add_inputs, title='', **kwargs):
        super(OffshorePlot, self).__init__(**kwargs)
        self.fig = plt.figure(num=None, facecolor='w', edgecolor='k') #figsize=(13, 8), dpi=1000
        self.shape_plot = self.fig.add_subplot(121)
        self.objf_plot = self.fig.add_subplot(122)

        self.targname = add_inputs
        self.title = title

        # Adding automatically the inputs
        for i in add_inputs:
            self.add(i, Float(0.0, iotype='in'))

        #sns.set(style="darkgrid")
        #self.pal = sns.dark_palette("skyblue", as_cmap=True)
        plt.rc('lines', linewidth=1)
        plt.ion()
        self.force_execute = True
        if not pa('fig').exists():
            pa('fig').mkdir() 
開發者ID:DTUWindEnergy,項目名稱:TOPFARM,代碼行數:22,代碼來源:plot.py

示例2: plot_wind_rose

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def plot_wind_rose(wind_rose):
    fig = plt.figure(figsize=(12,5), dpi=1000)

    # Plotting the wind statistics
    ax1 = plt.subplot(121, polar=True)
    w = 2.*np.pi/len(wind_rose.frequency)
    b = ax1.bar(np.pi/2.0-np.array(wind_rose.wind_directions)/180.*np.pi - w/2.0, 
                np.array(wind_rose.frequency)*100, width=w)

    # Trick to set the right axes (by default it's not oriented as we are used to in the WE community)
    mirror = lambda d: 90.0 - d if d < 90.0 else 360.0 + (90.0 - d)
    ax1.set_xticklabels([u'%d\xb0'%(mirror(d)) for d in linspace(0.0, 360.0,9)[:-1]]);
    ax1.set_title('Wind direction frequency');

    # Plotting the Weibull A parameter
    ax2 = plt.subplot(122, polar=True)
    b = ax2.bar(np.pi/2.0-np.array(wind_rose.wind_directions)/180.*np.pi - w/2.0, 
                np.array(wind_rose.A), width=w)
    ax2.set_xticklabels([u'%d\xb0'%(mirror(d)) for d in linspace(0.0, 360.0,9)[:-1]]);
    ax2.set_title('Weibull A parameter per wind direction sectors'); 
開發者ID:DTUWindEnergy,項目名稱:TOPFARM,代碼行數:22,代碼來源:plot.py

示例3: quality_over_time

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def quality_over_time(dfs, path, figformat, title, plot_settings={}):
    time_qual = Plot(path=path + "TimeQualityViolinPlot." + figformat,
                     title="Violin plot of quality over time")
    sns.set(style="white", **plot_settings)
    ax = sns.violinplot(x="timebin",
                        y="quals",
                        data=dfs,
                        inner=None,
                        cut=0,
                        linewidth=0)
    ax.set(xlabel='Interval (hours)',
           ylabel="Basecall quality",
           title=title or time_qual.title)
    plt.xticks(rotation=45, ha='center', fontsize=8)
    time_qual.fig = ax.get_figure()
    time_qual.save(format=figformat)
    plt.close("all")
    return time_qual 
開發者ID:wdecoster,項目名稱:NanoPlot,代碼行數:20,代碼來源:timeplots.py

示例4: sequencing_speed_over_time

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def sequencing_speed_over_time(dfs, path, figformat, title, plot_settings={}):
    time_duration = Plot(path=path + "TimeSequencingSpeed_ViolinPlot." + figformat,
                         title="Violin plot of sequencing speed over time")
    sns.set(style="white", **plot_settings)
    if "timebin" not in dfs:
        dfs['timebin'] = add_time_bins(dfs)
    mask = dfs['duration'] != 0
    ax = sns.violinplot(x=dfs.loc[mask, "timebin"],
                        y=dfs.loc[mask, "lengths"] / dfs.loc[mask, "duration"],
                        inner=None,
                        cut=0,
                        linewidth=0)
    ax.set(xlabel='Interval (hours)',
           ylabel="Sequencing speed (nucleotides/second)",
           title=title or time_duration.title)
    plt.xticks(rotation=45, ha='center', fontsize=8)
    time_duration.fig = ax.get_figure()
    time_duration.save(format=figformat)
    plt.close("all")
    return time_duration 
開發者ID:wdecoster,項目名稱:NanoPlot,代碼行數:22,代碼來源:timeplots.py

示例5: yield_by_minimal_length_plot

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def yield_by_minimal_length_plot(array, name, path,
                                 title=None, color="#4CB391", figformat="png"):
    df = pd.DataFrame(data={"lengths": np.sort(array)[::-1]})
    df["cumyield_gb"] = df["lengths"].cumsum() / 10**9
    yield_by_length = Plot(
        path=path + "Yield_By_Length." + figformat,
        title="Yield by length")
    ax = sns.regplot(
        x='lengths',
        y="cumyield_gb",
        data=df,
        x_ci=None,
        fit_reg=False,
        color=color,
        scatter_kws={"s": 3})
    ax.set(
        xlabel='Read length',
        ylabel='Cumulative yield for minimal length',
        title=title or yield_by_length.title)
    yield_by_length.fig = ax.get_figure()
    yield_by_length.save(format=figformat)
    plt.close("all")
    return yield_by_length 
開發者ID:wdecoster,項目名稱:NanoPlot,代碼行數:25,代碼來源:nanoplotter_main.py

示例6: image

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def image(path: str, costs: Dict[str, int]) -> str:
    ys = ['0', '1', '2', '3', '4', '5', '6', '7+', 'X']
    xs = [costs.get(k, 0) for k in ys]
    sns.set_style('white')
    sns.set(font='Concourse C3', font_scale=3)
    g = sns.barplot(ys, xs, palette=['#cccccc'] * len(ys))
    g.axes.yaxis.set_ticklabels([])
    rects = g.patches
    sns.set(font='Concourse C3', font_scale=2)
    for rect, label in zip(rects, xs):
        if label == 0:
            continue
        height = rect.get_height()
        g.text(rect.get_x() + rect.get_width()/2, height + 0.5, label, ha='center', va='bottom')
    g.margins(y=0, x=0)
    sns.despine(left=True, bottom=True)
    g.get_figure().savefig(path, transparent=True, pad_inches=0, bbox_inches='tight')
    plt.clf() # Clear all data from matplotlib so it does not persist across requests.
    return path 
開發者ID:PennyDreadfulMTG,項目名稱:Penny-Dreadful-Tools,代碼行數:21,代碼來源:chart.py

示例7: _plot_weights

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def _plot_weights(self, title, file, layer_index=0, vmin=-5, vmax=5):
        import seaborn as sns
        sns.set_context("paper")

        layers = self.iwp.estimator.steps[-1][1].coefs_
        layer = layers[layer_index]
        f, ax = plt.subplots(figsize=(18, 12))
        weights = pd.DataFrame(layer)
        weights.index = self.iwp.inputs

        sns.set(font_scale=1.1)

        # Draw a heatmap with the numeric values in each cell
        sns.heatmap(
            weights, annot=True, fmt=".1f", linewidths=.5, ax=ax,
            cmap="difference", center=0, vmin=vmin, vmax=vmax,
            # annot_kws={"size":14},
        )
        ax.tick_params(labelsize=18)
        f.tight_layout()
        f.savefig(file) 
開發者ID:atmtools,項目名稱:typhon,代碼行數:23,代碼來源:common.py

示例8: enrich_activity

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def enrich_activity(seqs, seqs_1hot, targets, activity_enrich, target_indexes):
  """ Filter data for the most active sequences in the set. """

  # compute the max across sequence lengths and mean across targets
  seq_scores = targets[:, :, target_indexes].max(axis=1).mean(
      axis=1, dtype='float64')

  # sort the sequences
  scores_indexes = [(seq_scores[si], si) for si in range(seq_scores.shape[0])]
  scores_indexes.sort(reverse=True)

  # filter for the top
  enrich_indexes = sorted(
      [scores_indexes[si][1] for si in range(seq_scores.shape[0])])
  enrich_indexes = enrich_indexes[:int(activity_enrich * len(enrich_indexes))]
  seqs = [seqs[ei] for ei in enrich_indexes]
  seqs_1hot = seqs_1hot[enrich_indexes]
  targets = targets[enrich_indexes]

  return seqs, seqs_1hot, targets 
開發者ID:calico,項目名稱:basenji,代碼行數:22,代碼來源:basenji_sat_h5.py

示例9: plot_kernel

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def plot_kernel(kernel_weights, out_pdf):
    depth, width = kernel_weights.shape
    fig_width = 2 + 1.5*np.log2(width)

    # normalize
    kernel_weights -= kernel_weights.mean(axis=0)

    # plot
    sns.set(font_scale=1.5)
    plt.figure(figsize=(fig_width, depth))
    sns.heatmap(kernel_weights, cmap='PRGn', linewidths=0.2, center=0)
    ax = plt.gca()
    ax.set_xticklabels(range(1,width+1))

    if depth == 4:
        ax.set_yticklabels('ACGT', rotation='horizontal')
    else:
        ax.set_yticklabels(range(1,depth+1), rotation='horizontal')

    plt.savefig(out_pdf)
    plt.close() 
開發者ID:calico,項目名稱:basenji,代碼行數:23,代碼來源:basenji_motifs_denovo.py

示例10: generate_speed_graph

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def generate_speed_graph(data, filename="als_speed.png", keys=['gpu', 'cg2', 'cg3', 'cholesky'],
                         labels=None, colours=None):
    labels = labels or {}
    colours = colours or {}

    seaborn.set()
    fig, ax = plt.subplots()

    factors = data['factors']
    for key in keys:
        ax.plot(factors, data[key],
                color=colours.get(key, COLOURS.get(key)),
                marker='o', markersize=6)

        ax.text(factors[-1] + 5, data[key][-1], labels.get(key, LABELS[key]), fontsize=10)

    ax.set_ylabel("Seconds per Iteration")
    ax.set_xlabel("Factors")
    plt.savefig(filename, bbox_inches='tight', dpi=300) 
開發者ID:benfred,項目名稱:implicit,代碼行數:21,代碼來源:benchmark_als.py

示例11: main

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def main():
    args = parse_args()
    X, labels = np.loadtxt(args.embeddings_path), np.loadtxt(args.labels_path, dtype=np.str)
    tsne = TSNE(n_components=2, n_iter=10000, perplexity=5, init='pca', learning_rate=200, verbose=1)
    transformed = tsne.fit_transform(X)

    y = set(labels)
    labels = np.array(labels)
    plt.figure(figsize=(20, 14))
    colors = cm.rainbow(np.linspace(0, 1, len(y)))
    for label, color in zip(y, colors):
        points = transformed[labels == label, :]
        plt.scatter(points[:, 0], points[:, 1], c=[color], label=label, s=200, alpha=0.5)
        for p1, p2 in random.sample(list(zip(points[:, 0], points[:, 1])), k=min(1, len(points))):
            plt.annotate(label, (p1, p2), fontsize=30)

    plt.savefig('tsne_visualization.png', transparent=True, bbox_inches='tight', pad_inches=0)
    plt.show() 
開發者ID:arsfutura,項目名稱:face-recognition,代碼行數:20,代碼來源:tsne_visualization.py

示例12: getEdgeHistogram

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def getEdgeHistogram(inGraph, refGraph):
    falsePositives = set(inGraph.edges()).difference(refGraph.edges())
    edgeHistogramCounts = {0:0}
    
    for fe in falsePositives:
        u,v = fe
        try:
            path = nx.dijkstra_path(refGraph,u,v)
            pathlength = len(path) -1 
            if pathlength in edgeHistogramCounts.keys():
                edgeHistogramCounts[pathlength] +=1
            else:
                edgeHistogramCounts[pathlength] = 0
            
        except nx.exception.NetworkXNoPath:
            edgeHistogramCounts[0] +=1
    return edgeHistogramCounts 
開發者ID:Murali-group,項目名稱:Beeline,代碼行數:19,代碼來源:computePathStats.py

示例13: make_reddit_prop_plt

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def make_reddit_prop_plt():
    sns.set()
    prop_expt = pd.DataFrame(att.process_propensity_experiment())

    prop_expt = prop_expt[['exog', 'plugin', 'one_step_tmle', 'very_naive']]
    prop_expt = prop_expt.rename(index=str, columns={'exog': 'Exogeneity',
                                         'very_naive': 'Unadjusted',
                                         'plugin': 'Plug-in',
                                         'one_step_tmle': 'TMLE'})
    prop_expt = prop_expt.set_index('Exogeneity')

    plt.figure(figsize=(4.75, 3.00))
    # plt.figure(figsize=(2.37, 1.5))
    sns.scatterplot(data=prop_expt, legend='brief', s=75)
    plt.xlabel("Exogeneity", fontfamily='monospace')
    plt.ylabel("NDE Estimate", fontfamily='monospace')
    plt.tight_layout()

    fig_dir = '../output/figures'
    os.makedirs(fig_dir, exist_ok=True)
    plt.savefig(os.path.join(fig_dir,'reddit_propensity.pdf')) 
開發者ID:blei-lab,項目名稱:causal-text-embeddings,代碼行數:23,代碼來源:prop_sim_plotting.py

示例14: get_protein_feather_paths

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def get_protein_feather_paths(protgroup, memornot, protgroup_dict, protein_feathers_dir, core_only_genes=None):
    """
    protgroup example: ('subsystem', 'cog_primary', 'H')
    memornot example: ('vizrecon', 'membrane')
    protgroup_dict example: {'databases': {'redoxdb': {'experimental_sensitive_cys': ['b2518','b3352','b2195','b4016'], ...}}}
    """
    prots_memornot = protgroup_dict['localization'][memornot[0]][memornot[1]]

    if protgroup[0] == 'localization':
        if protgroup[2] != 'all':
            if memornot[1] in ['membrane', 'inner_membrane', 'outer_membrane'] and protgroup[2] not in ['membrane', 'inner_membrane', 'outer_membrane']:
                return []
            if memornot[1] not in ['membrane', 'inner_membrane', 'outer_membrane'] and protgroup[2] in ['membrane', 'inner_membrane', 'outer_membrane']:
                return []

    prots_group = protgroup_dict[protgroup[0]][protgroup[1]][protgroup[2]]
    prots_filtered = list(set(prots_group).intersection(prots_memornot))
    if core_only_genes:
        prots_filtered = list(set(prots_filtered).intersection(core_only_genes))
    return [op.join(protein_feathers_dir, '{}_protein_strain_properties.fthr'.format(x)) for x in prots_filtered if op.exists(op.join(protein_feathers_dir, '{}_protein_strain_properties.fthr'.format(x)))] 
開發者ID:SBRG,項目名稱:ssbio,代碼行數:22,代碼來源:atlas3.py

示例15: make_biplot

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import set [as 別名]
def make_biplot(self, pc_x=1, pc_y=2, outpath=None, dpi=150, custom_markers=None, custom_order=None):
        if not custom_order:
            custom_order = sorted(self.observations_df[self.observation_colname].unique().tolist())
        if not custom_markers:
            custom_markers = self.markers
        plot = sns.lmplot(data=self.principal_observations_df,
                              x=self.principal_observations_df.columns[pc_x - 1],
                              y=self.principal_observations_df.columns[pc_y - 1],
                              hue=self.observation_colname,
                              hue_order=custom_order,
                              fit_reg=False,
                              size=6,
                              markers=custom_markers,
                            scatter_kws={'alpha': 0.5})
        plot = (plot.set(title='PC{} vs. PC{}'.format(pc_x, pc_y)))
        if outpath:
            plot.savefig(outpath, dpi=dpi)
        else:
            plt.show()
        plt.close() 
開發者ID:SBRG,項目名稱:ssbio,代碼行數:22,代碼來源:atlas3.py


注:本文中的seaborn.set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。