本文整理汇总了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')
示例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')
示例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()
示例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)
示例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')
示例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