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


Python seaborn.PairGrid方法代碼示例

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


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

示例1: plot_posterior_histogram

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import PairGrid [as 別名]
def plot_posterior_histogram(model, variables, number_samples=300): #TODO: fix code duplication

    # Get samples
    sample = model.get_sample(number_samples)
    post_sample = model.get_posterior_sample(number_samples)

    # Join samples
    sample["Mode"] = "Prior"
    post_sample["Mode"] = "Posterior"
    subsample = sample[variables + ["Mode"]]
    post_subsample = post_sample[variables + ["Mode"]]
    joint_subsample = subsample.append(post_subsample)

    # Plot posterior
    warnings.filterwarnings('ignore')
    g = sns.PairGrid(joint_subsample, hue="Mode")
    g = g.map_offdiag(sns.distplot)
    g = g.map_diag(sns.distplot)
    g = g.add_legend()
    warnings.filterwarnings('default') 
開發者ID:AI-DI,項目名稱:Brancher,代碼行數:22,代碼來源:visualizations.py

示例2: plot_posterior

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import PairGrid [as 別名]
def plot_posterior(model, variables, number_samples=1000):

    # Get samples
    sample = model.get_sample(number_samples)
    post_sample = model.get_posterior_sample(number_samples)

    # Join samples
    sample["Mode"] = "Prior"
    post_sample["Mode"] = "Posterior"
    subsample = sample[variables + ["Mode"]]
    post_subsample = post_sample[variables + ["Mode"]]
    joint_subsample = subsample.append(post_subsample)

    # Plot posterior
    warnings.filterwarnings('ignore')
    g = sns.PairGrid(joint_subsample, hue="Mode")
    g = g.map_offdiag(sns.kdeplot)
    g = g.map_diag(sns.kdeplot, lw=3, shade=True)
    g = g.add_legend()
    warnings.filterwarnings('default') 
開發者ID:AI-DI,項目名稱:Brancher,代碼行數:22,代碼來源:visualizations.py

示例3: plotCorrelation

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import PairGrid [as 別名]
def plotCorrelation(stats):
    #columnsToDrop = ['sleep_interval_max_len', 'sleep_interval_min_len',
    #                 'sleep_interval_avg_len', 'sleep_inefficiency',
    #                 'sleep_hours', 'total_hours']

    #stats = stats.drop(columnsToDrop, axis=1)

    g = sns.PairGrid(stats)
    def corrfunc(x, y, **kws):
        r, p = scipystats.pearsonr(x, y)
        ax = plt.gca()
        ax.annotate("r = {:.2f}".format(r),xy=(.1, .9), xycoords=ax.transAxes)
        ax.annotate("p = {:.2f}".format(p),xy=(.2, .8), xycoords=ax.transAxes)
        if p>0.04:
            ax.patch.set_alpha(0.1)

    g.map_upper(plt.scatter)
    g.map_diag(plt.hist)
    g.map_lower(sns.kdeplot, cmap="Blues_d")
    g.map_upper(corrfunc)
    sns.plt.show() 
開發者ID:5agado,項目名稱:fitbit-analyzer,代碼行數:23,代碼來源:plotting.py

示例4: geoValueWeightedVisulization

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import PairGrid [as 別名]
def geoValueWeightedVisulization(valueDes):
    valueDes["ID"]=valueDes.index
    sns.set(style="whitegrid")
    # Make the PairGrid
    extractedColumns=["count","mean","std","max"]
    g=sns.PairGrid(valueDes.sort_values("count", ascending=False),x_vars=extractedColumns, y_vars=["ID"],height=10, aspect=.25)
    # Draw a dot plot using the stripplot function
    g.map(sns.stripplot, size=10, orient="h",palette="ch:s=1,r=-.1,h=1_r", linewidth=1, edgecolor="w")    
    # Use the same x axis limits on all columns and add better labels
    g.set(xlabel="value", ylabel="") #g.set(xlim=(0, 25), xlabel="Crashes", ylabel="")
    # Use semantically meaningful titles for the columns
    titles=valueDes.columns.tolist() 
    for ax, title in zip(g.axes.flat, titles):
        # Set a different title for each axes
        ax.set(title=title)
        # Make the grid horizontal instead of vertical
        ax.xaxis.grid(False)
        ax.yaxis.grid(True)
    sns.despine(left=True, bottom=True) 
開發者ID:richieBao,項目名稱:python-urbanPlanning,代碼行數:21,代碼來源:distanceWeightStatistic.py

示例5: plot_density

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import PairGrid [as 別名]
def plot_density(model, variables, number_samples=2000):
    sample = model.get_sample(number_samples)
    warnings.filterwarnings('ignore')
    g = sns.PairGrid(sample[variables])
    g = g.map_offdiag(sns.kdeplot)
    g = g.map_diag(sns.kdeplot, lw=3, shade=True)
    g = g.add_legend()
    warnings.filterwarnings('default') 
開發者ID:AI-DI,項目名稱:Brancher,代碼行數:10,代碼來源:visualizations.py

示例6: geoValVisulization_a

# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import PairGrid [as 別名]
def geoValVisulization_a(geoPd):
    geoPd["ID"]=geoPd.index.astype(str)
    print(geoPd.columns)
    '''
Index(['park_no', 'label', 'park_class', 'location', 'acres', 'shape_area',
       'shape_leng', 'perimeter', 'geometry', 'shapelyArea', 'shapelyLength',
       'shapeIdx', 'FRAC', 'popu_count', 'popu_mean', 'popu_std', 'popu_min',
       'popu_25%', 'popu_50%', 'popu_75%', 'popu_max', 'SVFW_count',
       'SVFW_mean', 'SVFW_std', 'SVFW_min', 'SVFW_25%', 'SVFW_50%', 'SVFW_75%',
       'SVFW_max', 'polyID', 'SVFep_min', 'SVFep_max', 'SVFep_mean',
       'SVFep_count', 'SVFep_sum', 'SVFep_std', 'SVFep_median',
       'SVFep_majority', 'SVFep_minority', 'SVFep_unique', 'SVFep_range',
       'SVFep_nodata', 'HVege_min', 'HVege_max', 'HVege_mean', 'HVege_count',
       'HVege_sum', 'HVege_std', 'HVege_median', 'HVege_majority',
       'HVege_minority', 'HVege_range', 'HVege_nodata', 'MVege_min',
       'MVege_max', 'MVege_mean', 'MVege_count', 'MVege_sum', 'MVege_std',
       'MVege_median', 'MVege_majority', 'MVege_minority', 'MVege_range',
       'MVege_nodata', 'LVege_min', 'LVege_max', 'LVege_mean', 'LVege_count',
       'LVege_sum', 'LVege_std', 'LVege_median', 'LVege_majority',
       'LVege_minority', 'LVege_range', 'LVege_nodata', 'facilityFre',
       'facilityID', 'cla_treeCanopy', 'cla_grassShrub', 'cla_bareSoil',
       'cla_buildings', 'cla_roadsRailraods', 'cla_otherPavedSurfaces',
       'cla_water', 'classi_count', 'ID'],
      dtype='object')
    '''
    sns.set(style="whitegrid")
    
    # Make the PairGrid
    extractedColumns=['shapelyArea','shapelyLength',
                      'shapeIdx','FRAC',
                      'SVFW_mean','SVFW_std',
                      'SVFW_mean','SVFW_std',
                      'popu_std','popu_mean',                      
                      'facilityFre',
                      'classi_count','cla_treeCanopy', 'cla_grassShrub','cla_bareSoil', 'cla_buildings', 'cla_roadsRailraods', 'cla_otherPavedSurfaces','cla_water',
                      'HVege_count','HVege_mean',
                      'LVege_count','LVege_mean',
                      
                      ]
    # geoPdSort=geoPd.sort_values('shapelyArea', ascending=False)
    g=sns.PairGrid(geoPd.sort_values('shapelyArea', ascending=False),x_vars=extractedColumns, y_vars=["label"],height=20, aspect=.25)
    # g=sns.PairGrid(geoPd,x_vars=extractedColumns, y_vars=["ID"],height=20, aspect=.25)

    # Draw a dot plot using the stripplot function
    g.map(sns.stripplot, size=5, orient="h",palette="ch:s=1,r=-.1,h=1_r", linewidth=1, edgecolor="w")    
    # Use the same x axis limits on all columns and add better labels
    g.set(xlabel="value", ylabel="") #g.set(xlim=(0, 25), xlabel="Crashes", ylabel="")
    # Use semantically meaningful titles for the columns
    g.fig.set_figwidth(30)
    g.fig.set_figheight(80)
    
    titles=extractedColumns
    for ax, title in zip(g.axes.flat, titles):
        # Set a different title for each axes
        ax.set(title=title)
        # Make the grid horizontal instead of vertical
        ax.xaxis.grid(False)
        ax.yaxis.grid(True)
    sns.despine(left=True, bottom=True)        

    return geoPd 
開發者ID:richieBao,項目名稱:python-urbanPlanning,代碼行數:63,代碼來源:valueWeightStatistic_merge.py


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