seaborn

How to use custom error bar in seaborn lineplot?

一个人想着一个人 提交于 2021-01-27 07:03:12
问题 I am using seaborn.lineplot to generate some time series plots. I have pre-compute a specific kind of error bars in two lists, e.g., upper=[1,2,3,4,5] lower=[0,1,2,3,4] . Is there a way I could customize the error bar here, instead of using the CI or Std error bars in lineplot ? 回答1: If you want error bands/bars other than the ones that seaborn.lineplot offers, you have to plot them yourself. Here are a couple examples of how to draw an error band and error bars in matplotlib and get plots

unwanted blank subplots in matplotlib

大城市里の小女人 提交于 2021-01-27 06:49:43
问题 I am new to matplotlib and seaborn and is currently trying to practice the two libraries using the classic titanic dataset. This might be elementary, but I'm trying to plot two factorplots side by side by inputting the argument ax = matplotlib axis as shown in the code below: import matploblib.pyplot as plt import seaborn as sns %matplotlib inline fig, (axis1,axis2) = plt.subplots(1,2,figsize=(15,4)) sns.factorplot(x='Pclass',data=titanic_df,kind='count',hue='Survived',ax=axis1) sns

Add seaborn.palplot axes to existing figure for visualisation of different color palettes

徘徊边缘 提交于 2021-01-27 06:09:40
问题 Adding seaborn figures to subplots is usually done by passing 'ax' when creating the figure. For instance: sns.kdeplot(x, y, cmap=cmap, shade=True, cut=5, ax=ax) This method, however, doesn't apply to seaborn.palplot, which visualizes seaborn color palettes. My goal is to create a figure of different color palettes for scalable color comparison and presentation. This image roughly shows the figure I'm trying to create [source]. A possibly related answer describes a method of creating a

Add seaborn.palplot axes to existing figure for visualisation of different color palettes

≡放荡痞女 提交于 2021-01-27 06:09:30
问题 Adding seaborn figures to subplots is usually done by passing 'ax' when creating the figure. For instance: sns.kdeplot(x, y, cmap=cmap, shade=True, cut=5, ax=ax) This method, however, doesn't apply to seaborn.palplot, which visualizes seaborn color palettes. My goal is to create a figure of different color palettes for scalable color comparison and presentation. This image roughly shows the figure I'm trying to create [source]. A possibly related answer describes a method of creating a

Plot datetime.time in seaborn

最后都变了- 提交于 2021-01-22 04:25:27
问题 Hi I am having trouble plotting a datetime with seaborn. I am trying to plot a categorical data with x as datatype datetime.time but I get these error: float() argument must be a string or a number, not 'datetime.time' This is my df: toronto_time description 0 00:00:50 STATS 1 00:01:55 STATS 2 00:02:18 ONLINE 3 00:05:24 STATS 4 00:05:34 STATS 5 00:06:33 OFFLINE This is my code: import matplotlib.pyplot as plt import seaborn as sns plt.style.use('seaborn-colorblind') plt.figure(figsize=(8,6))

Plot datetime.time in seaborn

五迷三道 提交于 2021-01-22 04:24:47
问题 Hi I am having trouble plotting a datetime with seaborn. I am trying to plot a categorical data with x as datatype datetime.time but I get these error: float() argument must be a string or a number, not 'datetime.time' This is my df: toronto_time description 0 00:00:50 STATS 1 00:01:55 STATS 2 00:02:18 ONLINE 3 00:05:24 STATS 4 00:05:34 STATS 5 00:06:33 OFFLINE This is my code: import matplotlib.pyplot as plt import seaborn as sns plt.style.use('seaborn-colorblind') plt.figure(figsize=(8,6))

Plot datetime.time in seaborn

风流意气都作罢 提交于 2021-01-22 04:24:45
问题 Hi I am having trouble plotting a datetime with seaborn. I am trying to plot a categorical data with x as datatype datetime.time but I get these error: float() argument must be a string or a number, not 'datetime.time' This is my df: toronto_time description 0 00:00:50 STATS 1 00:01:55 STATS 2 00:02:18 ONLINE 3 00:05:24 STATS 4 00:05:34 STATS 5 00:06:33 OFFLINE This is my code: import matplotlib.pyplot as plt import seaborn as sns plt.style.use('seaborn-colorblind') plt.figure(figsize=(8,6))

Python可视化 | Seaborn包—heatmap()

…衆ロ難τιáo~ 提交于 2021-01-21 13:45:14
seaborn.heatmap()的参数 seaborn.heatmap(data, vmin=None, vmax=None, cmap=None, center=None, robust=False, annot=None, fmt='.2g', annot_kws=None, linewidths=0, linecolor='white', cbar=True, cbar_kws=None, cbar_ax=None, square=False, xticklabels='auto', yticklabels='auto', mask=None, ax=None, **kwargs) ⚪ 绘制热图 uniform_data = np.random.rand(10,12) #随机创建10行12列的数组 pd.DataFrame(uniform_data) #以一个数据框的格式来显示 f,ax = plt.subplots(figsize=(9,6)) #定义一个子图宽高为9和6 ax存储的是图形放在哪个位置 ax = sns.heatmap(uniform_data,vmin = 0,vmax = 1) #vmin,vmax定义了色彩图的上下界 # sns.heatmap(uniform_data) #此语句会默认图形的大小画热图    ⚪

Draw a horizontal line line at specific position/annotate a Facetgrid in seaborn

天大地大妈咪最大 提交于 2021-01-20 19:08:31
问题 A have produced a boxplot with Facetgrid in seaborn the following way # Import the dataset tips = sns.load_dataset("tips") # Plot using Facegrid, separated by smoke plt.style.use('ggplot') g = sns.FacetGrid(tips, col="smoker", size=5, aspect=1.5) g.map(sns.boxplot, "sex", "total_bill", palette='viridis', order=['Male', 'Female']) plt.show() I now want to draw to distinct horizontal lines in each of the plot. For instance one horizontal line (with coordinated (0,10)) only in the left-hand side

Draw a horizontal line line at specific position/annotate a Facetgrid in seaborn

孤者浪人 提交于 2021-01-20 18:57:58
问题 A have produced a boxplot with Facetgrid in seaborn the following way # Import the dataset tips = sns.load_dataset("tips") # Plot using Facegrid, separated by smoke plt.style.use('ggplot') g = sns.FacetGrid(tips, col="smoker", size=5, aspect=1.5) g.map(sns.boxplot, "sex", "total_bill", palette='viridis', order=['Male', 'Female']) plt.show() I now want to draw to distinct horizontal lines in each of the plot. For instance one horizontal line (with coordinated (0,10)) only in the left-hand side