本文整理匯總了Python中seaborn.pointplot方法的典型用法代碼示例。如果您正苦於以下問題:Python seaborn.pointplot方法的具體用法?Python seaborn.pointplot怎麽用?Python seaborn.pointplot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類seaborn
的用法示例。
在下文中一共展示了seaborn.pointplot方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: violinplot
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import pointplot [as 別名]
def violinplot(set_size, p_error, subplot, i):
"""Make learning cuves with violinplot.
Parameters
----------
set_size : list
Size of sub-set of data/features which the model is based on.
p_error : list
The prediction error for plain vanilla ridge.
subplot : int
Which subplot being produced.
i : int
Which iteration in the featureselection.
"""
plt.figure(1)
plt.subplot(int("22" + str(subplot))).set_title('Feature size ' + str(i),
loc='left')
plt.legend(loc='upper right')
plt.ylabel('Prediction error')
plt.xlabel('Data size')
sns.violinplot(x=set_size, y=p_error, scale="count")
sns.pointplot(x=set_size, y=p_error, ci=100, capsize=.2)
if subplot == 4:
plt.show()
示例2: featselect_featvar_plot
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import pointplot [as 別名]
def featselect_featvar_plot(p_error_select, number_feat):
"""Create learning curve with data size and prediction error.
Parameters
----------
data_size : list
Data_size for where the prediction were made.
p_error : list
Error for where the prediction were made.
data_size_mean : list
Mean of the data size in a sub-set.
p_error_mean : list
The mean error for the sub-set.
corrected_std : array
The standard deaviation for the sub-set of data.
"""
fig = plt.figure()
fig.add_subplot(111)
sns.violinplot(x=number_feat, y=p_error_select, scale="count")
sns.pointplot(x=number_feat, y=p_error_select)
plt.legend(loc='upper right')
plt.ylabel('Prediction error')
plt.xlabel('Data size')
plt.show()
示例3: main
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import pointplot [as 別名]
def main():
args = get_args()
region_df = read_mosdepth(args.mosdepth_combined, args.region)
fig, ax = plt.subplots(figsize=(16, 8))
ax = sns.pointplot(x="begin",
y="coverage",
hue="name",
data=region_df,
scale=0.1,
ax=ax)
ax.set(xlabel="position",
ylabel="normalizes coverage")
plt.xticks([tick for i, tick in enumerate(list(plt.xticks()[0])) if not i % 5],
rotation=30,
ha='center')
plt.savefig("Mosdepth_{}.png".format(args.region), dpi=500, bbox_inches='tight')
示例4: plotDailyStatsSleep
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import pointplot [as 別名]
def plotDailyStatsSleep(stats, columns=None):
"""
Plot daily stats. Fill all data range, and put NaN for days without measures
:param data: data to plot
"""
MEASURE_NAME = 'date'
if not columns:
columns = ['sleep_inefficiency', 'sleep_hours']
dataToPlot = _prepareDailyStats(stats, columns)
f, axes = getAxes(2,1)
xTicksDiv = min(10, len(dataToPlot))
#xticks = [(x-pd.DateOffset(years=1, day=2)).date() for x in stats.date]
xticks = [x.date() for x in dataToPlot.date]
keptticks = xticks[::int(len(xticks)/xTicksDiv)]
xticks = ['' for _ in xticks]
xticks[::int(len(xticks)/xTicksDiv)] = keptticks
for i, c in enumerate(columns):
g =sns.pointplot(x=MEASURE_NAME, y=NAMES[c], data=dataToPlot, ax=axes[i])
g.set_xticklabels([])
g.set_xlabel('')
g.set_xticklabels(xticks, rotation=45)
sns.plt.show()
示例5: _plotWeekdayByMonthStats
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import pointplot [as 別名]
def _plotWeekdayByMonthStats(stats, stat_name):
dataToPlot = _prepareWeekdayByMonthStats(stats)
# Plot
g = sns.pointplot(data=dataToPlot, x="day", y=stat_name, hue="month", order=dayOfWeekOrder)
g.set(xlabel='')
g.set_ylabel(NAMES[stat_name])
return g
#sns.plt.show()
示例6: test_population_roi_over_time
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import pointplot [as 別名]
def test_population_roi_over_time():
# Style elements
palette=["#56B4E9", "#E69F00"]
data_dir = path.join(path.dirname(path.realpath(__file__)),"../../tests/data")
data_path = path.join(data_dir,'drs_activity.csv')
df = pd.read_csv(data_path)
df = df.rename(columns={'t':'Mean t-Statistic'})
df['Session']=df['Session'].map({
'ofM':'naïve',
'ofMaF':'acute',
'ofMcF1':'chronic/2w',
'ofMcF2':'chronic/4w',
'ofMpF':'post',
})
# definitions for the axes
left, width = 0.06, 0.9
bottom, height = 0.06, 0.9
session_coordinates = [left, bottom, width, height]
roi_coordinates = [left+0.02, bottom+0.7, 0.3, 0.2]
fig = plt.figure(1)
ax1 = plt.axes(session_coordinates)
sns.pointplot(
x='Session',
y='Mean t-Statistic',
units='subject',
data=df,
hue='treatment',
dodge=True,
palette=palette,
order=['naïve','acute','chronic/2w','chronic/4w','post'],
ax=ax1,
ci=95,
)
ax2 = plt.axes(roi_coordinates)
maps.atlas_label('/usr/share/mouse-brain-atlases/dsurqec_200micron_roi-dr.nii',
scale=0.3,
color="#E69F00",
ax=ax2,
annotate=False,
alpha=0.8,
)
plt.savefig('_test_population_roi_over_time.png')
示例7: test_activity_timecourse_with_inlay
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import pointplot [as 別名]
def test_activity_timecourse_with_inlay():
import pandas as pd
import matplotlib.pyplot as plt
import samri.plotting.maps as maps
import seaborn as sns
from os import path
# Style elements
palette=["#56B4E9", "#E69F00"]
data_dir = path.join(path.dirname(path.realpath(__file__)),"../../tests/data")
data_path = path.join(data_dir,'drs_activity.csv')
df = pd.read_csv(data_path)
df = df.rename(columns={'t':'Mean t-Statistic'})
df['Session']=df['Session'].map({
'ofM':'naïve',
'ofMaF':'acute',
'ofMcF1':'chronic/2w',
'ofMcF2':'chronic/4w',
'ofMpF':'post',
})
# definitions for the axes
left, width = 0.06, 0.9
bottom, height = 0.06, 0.9
session_coordinates = [left, bottom, width, height]
roi_coordinates = [left+0.02, bottom+0.7, 0.3, 0.2]
fig = plt.figure(1)
ax1 = plt.axes(session_coordinates)
sns.pointplot(
x='Session',
y='Mean t-Statistic',
units='subject',
data=df,
hue='treatment',
dodge=True,
palette=palette,
order=['naïve','acute','chronic/2w','chronic/4w','post'],
ax=ax1,
ci=95,
)
ax2 = plt.axes(roi_coordinates)
maps.atlas_label('/usr/share/mouse-brain-atlases/dsurqec_200micron_roi-dr.nii',
scale=0.3,
color="#E69F00",
ax=ax2,
annotate=False,
alpha=0.8,
)
plt.savefig('_activity_timecourse_with_inlay.png')
示例8: visualisationDF
# 需要導入模塊: import seaborn [as 別名]
# 或者: from seaborn import pointplot [as 別名]
def visualisationDF(df):
dataFrameInfoPrint(df)
#graph-01
# df['shapelyArea'].plot.hist(alpha=0.5)
#graph-02
# df['shapelyArea'].plot.kde()
#graph-03
# df[['shapelyLength','shapeIdx']].plot.scatter('shapelyLength','shapeIdx')
#normalize data in a range of columns
cols_to_norm=['shapeIdx', 'FRAC']
df[cols_to_norm]=df[cols_to_norm].apply(lambda x: (x - x.min()) / (x.max() - x.min()))
a='shapeIdx'
b='FRAC'
c='park_class'
#graph-04
# sns.jointplot(a,b,df,kind='hex')
#graph-05
# sns.jointplot(a, b, df, kind='kde')
#graph-06
# sns.catplot(x='park_class',y=a,data=df)
#graph-07
'''
# Initialize the figure
f, ax = plt.subplots()
sns.despine(bottom=True, left=True)
# Show each observation with a scatterplot
sns.stripplot(x=a, y=c, hue=c,data=df, dodge=True, alpha=.25, zorder=1)
# Show the conditional means
sns.pointplot(x=a, y=c, hue=c,data=df, dodge=.532, join=False, palette="dark",markers="d", scale=.75, ci=None)
# Improve the legend
handles, labels = ax.get_legend_handles_labels()
ax.legend(handles[3:], labels[3:], title=b,handletextpad=0, columnspacing=1,loc="lower right", ncol=3, frameon=True)
'''
#graph-08
# sns.catplot(x=c,y=a,data=df,kind='box')
#graph-09
# sns.catplot(x=c,y=a,data=df,kind='violin')
#graph-10
'''
f, axs = plt.subplots(1, 2, figsize=(12, 6))
# First axis
df[b].plot.hist(ax=axs[0])
# Second axis
df[b].plot.kde(ax=axs[1])
# Title
f.suptitle(b)
# Display
plt.show()
'''
#從新定義柵格投影,參考投影為vector .shp文件