seaborn

How to change a figure's size in Python Seaborn package

拜拜、爱过 提交于 2019-12-17 16:26:12
问题 I'm having trouble increasing the size of my plot figures using Seaborn. I'm using sns.pairplot to plot columns of a data frame against one another. %matplotlib inline plt.rcParams['figure.figsize']=10,10 columns=list(df.columns.values) g=sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1']) The plots populate with data just fine, but the figure size is too small. I thought plot.rCParams['figure.figsize'] would control how large the figure is, but it doesn't seem to take effect.

Custom Annotation Seaborn Heatmap

◇◆丶佛笑我妖孽 提交于 2019-12-17 16:06:01
问题 I'm using Seaborn in Python to create a Heatmap. I'm able to annotate the cells with the values passed in, but I'd like to add annotations that signify what the cell means. For example, instead of merely seeing 0.000000 , I'd like to see the corresponding label, for instance "Foo," or 0.000000 (Foo) . The Seaborn documentation for the heatmap function is a bit cryptic with the parameter that I believe is the key here: annot_kws : dict of key, value mappings, optional Keyword arguments for ax

Seaborn factor plot custom error bars

孤人 提交于 2019-12-17 15:57:13
问题 I'd like to plot a factorplot in seaborn but manually provide the error bars instead of having seaborn calculate them. I have a pandas dataframe that looks roughly like this: model output feature mean std 0 first two a 9.00 2.00 1 first one b 0.00 0.00 2 first one c 0.00 0.00 3 first two d 0.60 0.05 ... 77 third four a 0.30 0.02 78 third four b 0.30 0.02 79 third four c 0.10 0.01 and I'm outputting a plot that looks roughly like this: I'm using this seaborn commands to generate the plot: g =

Plotting errors bars from dataframe using Seaborn FacetGrid

∥☆過路亽.° 提交于 2019-12-17 10:42:46
问题 I want to plot error bars from a column in a pandas dataframe on a Seaborn FacetGrid import matplotlib.pyplot as plt import pandas as pd import seaborn as sns df = pd.DataFrame({'A' : ['foo', 'bar', 'foo', 'bar']*2, 'B' : ['one', 'one', 'two', 'three', 'two', 'two', 'one', 'three'], 'C' : np.random.randn(8), 'D' : np.random.randn(8)}) df Example dataframe A B C D 0 foo one 0.445827 -0.311863 1 bar one 0.862154 -0.229065 2 foo two 0.290981 -0.835301 3 bar three 0.995732 0.356807 4 foo two 0

pandas - multi index plotting

对着背影说爱祢 提交于 2019-12-17 07:19:18
问题 I have some data where I've manipulated the dataframe using the following code: import pandas as pd import numpy as np data = pd.DataFrame([[0,0,0,3,6,5,6,1],[1,1,1,3,4,5,2,0],[2,1,0,3,6,5,6,1],[3,0,0,2,9,4,2,1],[4,0,1,3,4,8,1,1],[5,1,1,3,3,5,9,1],[6,1,0,3,3,5,6,1],[7,0,1,3,4,8,9,1]], columns=["id", "sex", "split", "group0Low", "group0High", "group1Low", "group1High", "trim"]) data #remove all where trim == 0 trimmed = data[(data.trim == 1)] trimmed #create df with columns to be split columns

Plotting time-series data with seaborn

 ̄綄美尐妖づ 提交于 2019-12-17 06:43:10
问题 Say I create a fully random Dataframe using the following: from pandas.util import testing from random import randrange def random_date(start, end): delta = end - start int_delta = (delta.days * 24 * 60 * 60) + delta.seconds random_second = randrange(int_delta) return start + timedelta(seconds=random_second) def rand_dataframe(): df = testing.makeDataFrame() df['date'] = [random_date(datetime.date(2014,3,18),datetime.date(2014,4,1)) for x in xrange(df.shape[0])] df.sort(columns=['date'],

Plotting time-series data with seaborn

落花浮王杯 提交于 2019-12-17 06:42:22
问题 Say I create a fully random Dataframe using the following: from pandas.util import testing from random import randrange def random_date(start, end): delta = end - start int_delta = (delta.days * 24 * 60 * 60) + delta.seconds random_second = randrange(int_delta) return start + timedelta(seconds=random_second) def rand_dataframe(): df = testing.makeDataFrame() df['date'] = [random_date(datetime.date(2014,3,18),datetime.date(2014,4,1)) for x in xrange(df.shape[0])] df.sort(columns=['date'],

How can I use seaborn without changing the matplotlib defaults?

限于喜欢 提交于 2019-12-17 05:47:52
问题 I am trying to use seaborn, because of its distplot function. But I prefer the default matplotlib settings. When I import seaborn, it changes automatically the appearance of my figure. How can I use seaborn functions without changing the look of the plots? 回答1: Version 0.8 (july 2017) changed this behaviour. From https://seaborn.pydata.org/whatsnew.html: The default (seaborn) style is no longer applied when seaborn is imported. It is now necessary to explicitly call set() or one or more of

Seaborn入门系列(二)——barplot&countplot&pointplot

北城余情 提交于 2019-12-17 02:13:50
微信公众号:易执 如有问题或建议,请公众号留言 Seaborn是基于matplotlib的Python可视化库。 它提供了一个高级界面来绘制有吸引力的统计图形。Seaborn其实是在matplotlib的基础上进行了更高级的API封装,从而使得作图更加容易,不需要 经过大量的调整就能使你的图变得精致。 注:所有代码均在IPython notebook中实现 barplot(条形图) 条形图表示数值变量与每个矩形高度的中心趋势的估计值,并使用误差线提供关于该估计值附近的不确定性的一些指示。具体用法如下: seaborn.barplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, estimator=(function mean), ci=95, n_boot=1000, units=None, orient=None, color=None, palette=None, saturation=0.75, errcolor='.26', errwidth=None, capsize=None, dodge=True, ax=None, **kwargs) 接下来还是通过具体例子学习里面的一些参数的用法: %matplotlib inline import pandas as pd import

为什么训练集和测试集合都是来自同一分布【转载】

牧云@^-^@ 提交于 2019-12-16 02:17:28
什么是分布 我们说训练集和测试集服从同分布的意思是训练集和测试集都是由服从同一个分布的随机样本组成的,也就是 (Xtrain,Ytrain),(Xtest,Ytest) i.i.d. ∼F(X,Y) 测试集合训练集分布的影响 训练模型的过程实际上是拟合了训练数据的分布,如果测试数据的分布跟训练数据不一致,那么就会影响模型的效果。 参考吴恩达老师的例子 通俗的解释【网友给出的白话解释】---(我会在之后的学习中再返回来解释清楚) 1.就是别用从动画片数据集里做出来的动物识别程序去识别纪录片里的动物。 2.同一分布什么的还是比较抽象,以我的理解同一分布也就是训练集和测试集是一类图像就可以了。 怎么查看数据分布 具体可以查看官方文档更详细 1.直方图 利用matplotlib 中 hist 函数 plt.hist(TData, bins=50, color='steelblue', normed=True ) 2.利用seaborn seaborn可以更快更精细的画出密度分布 import seaborn as sns sns.distplot(TData, rug=True 原作者:泛酸的桂花酒 转载链接:https://www.jianshu.com/p/e5b29abb3e83 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 来源: CSDN 作者: