Python seaborn.pointplot() Examples

The following are 8 code examples of seaborn.pointplot(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module seaborn , or try the search function .
Example #1
Source File: pltfile.py    From CatLearn with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #2
Source File: pltfile.py    From CatLearn with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #3
Source File: mosdepth_region_plot.py    From nano-snakemake with MIT License 6 votes vote down vote up
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') 
Example #4
Source File: plotting.py    From fitbit-analyzer with Apache License 2.0 6 votes vote down vote up
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() 
Example #5
Source File: plotting.py    From fitbit-analyzer with Apache License 2.0 5 votes vote down vote up
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() 
Example #6
Source File: test_maps.py    From SAMRI with GNU General Public License v3.0 4 votes vote down vote up
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') 
Example #7
Source File: test_compound.py    From SAMRI with GNU General Public License v3.0 4 votes vote down vote up
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') 
Example #8
Source File: distanceWeightCalculation_raster2Polygon.py    From python-urbanPlanning with MIT License 4 votes vote down vote up
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文件