seaborn

inner() got multiple values for argument 'ax'

送分小仙女□ 提交于 2020-01-05 08:35:09
问题 In a Jupyter notebook with Python I am plotting a hexbin jointplot from two columns of a dataframe. The plot is correctly plotted but I cant manage to resize the picture. Here is the code: fig, ax = plt.subplots() fig.set_size_inches(11.7, 8.27) sns.jointplot(x=train['max1'], y=train['intangle'], kind="hex", color="#4CB391",ax=ax) plt.show() gut I get inner() got multiple values for argument 'ax' 回答1: The issue is that jointplot creates its own figure and axes. It therefore does not have an

Horizontal barplot in Seaborn using dataframe

半世苍凉 提交于 2020-01-04 04:37:08
问题 I am struggling with barplots in seaborn and I am not sure what I am doing wrong. The data is very simple: name totalCount Name1 2000 Name2 40000 Name3 50000 sns.barplot(x='name',y='totalCount',data=df) produces a bar plot that has mean(totalCount) instead of the actual count. sns.countplot('name',data=df) produces a bar plot with all count values on y-axis equal to 1. How do I generate the plot that has: totalCount on x-axis, name on y-axis? 回答1: Usually when plotting a bar chart, a vector

Horizontal barplot in Seaborn using dataframe

房东的猫 提交于 2020-01-04 04:37:07
问题 I am struggling with barplots in seaborn and I am not sure what I am doing wrong. The data is very simple: name totalCount Name1 2000 Name2 40000 Name3 50000 sns.barplot(x='name',y='totalCount',data=df) produces a bar plot that has mean(totalCount) instead of the actual count. sns.countplot('name',data=df) produces a bar plot with all count values on y-axis equal to 1. How do I generate the plot that has: totalCount on x-axis, name on y-axis? 回答1: Usually when plotting a bar chart, a vector

Seaborn FacetGrid PointPlot Add 1 Grid Line

醉酒当歌 提交于 2020-01-03 19:15:29
问题 Given the following: import seaborn as sns attend = sns.load_dataset("attention") sns.set_style("whitegrid", {'axes.grid' : False,'axes.edgecolor':'none'}) g = sns.FacetGrid(attend, col="subject", col_wrap=5, size=1.5, ylim=(0, 10)) ax = g.map(sns.pointplot, "solutions", "score", scale=.7) As you can see, I have removed all grid lines. I would now like to add just one horizontal grid line: at the value of 5 on the y-axis for each plot. Is this possible to do? I looked into the set_style

How to modify edge color of Violinplot using Seaborn

我只是一个虾纸丫 提交于 2020-01-03 14:28:11
问题 I'm trying to change the edge color of violins in Seaborn. And the code below, worked for me. ax=sns.violinplot(data=df, x="#", y="SleepAmount", hue="Thr", palette=my_pal, split=True,linewidth = 1, inner=None) ax2 = sns.pointplot(x="#", y="SleepAmount", hue="Thr", data=df, dodge=0.3, join=False, palette=['black'], ax=ax,errwidth=1, ci="sd", markers="_") plt.setp(ax.collections, edgecolor="k") plt.setp(ax2.collections, edgecolor="k") But when I use facetgrid, I have no idea how to adopt plt

FutureWarning with distplot in seaborn [duplicate]

家住魔仙堡 提交于 2020-01-03 13:37:08
问题 This question already has answers here : FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated use `arr[tuple(seq)]` (4 answers) Closed 11 months ago . I have this warning that shows up whenever I try to use distplot from seaborn , and I can't seem to figure out what I'm doing wrong, sorry if it's simple. Warning: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq] . In the future this

Python, Seaborn: Logarithmic Swarmplot has unexpected gaps in the swarm

别说谁变了你拦得住时间么 提交于 2020-01-03 04:48:13
问题 Let's look at a swarmplot, made with Python 3.5 and Seaborn on some data (which is stored in a pandas dataframe df with column lables stored in another class. This does not matter for now, just look at the plot): ax = sns.swarmplot(x=self.dte.label_temperature, y=self.dte.label_current, hue=self.dte.label_voltage, data = df) Now the data is more readable if plotted in log scale on the y-axis because it goes over some decades. So let's change the scaling to logarithmic: ax.set_yscale("log") ax

Make identical matplotlib plots with y-axes of different sizes

早过忘川 提交于 2020-01-03 02:48:18
问题 I am trying to make a series of matplotlib plots that plot timespans for different classes of objects. Each plot has an identical x-axis and plot elements like a title and a legend. However, which classes appear in each plot differs; each plot represents a different sampling unit, each of which only contains only a subset of all the possible classes. I am having a lot of trouble determining how to set the figure and axis dimensions. The horizontal size should always remain the same, but the

Pandas Seaborn Swarmplot doesn't plot

孤者浪人 提交于 2020-01-02 22:01:11
问题 I am trying to plot a seaborn swarmplot where col[2] is the freq and col[3] are the classes to be grouped by. Input is given below and the code too. Input tweetcricscore,51,high active tweetcricscore,46,event based tweetcricscore,12,event based tweetcricscore,46,event based tweetcricscore,1,viewers tweetcricscore,178,viewers tweetcricscore,46,situational tweetcricscore,23,situational tweetcricscore,1,situational tweetcricscore,8,situational tweetcricscore,56,situational Code: import numpy as

Distribution probabilities for each column data frame, in one plot

前提是你 提交于 2020-01-02 20:17:15
问题 I am creating probability distributions for each column of my data frame by distplot from seaborn library sns.distplot(). For one plot I do x = df['A'] sns.distplot(x); I am trying to use the FacetGrid & Map to have all plots for each columns at once in this way. But doesn't work at all. g = sns.FacetGrid(df, col = 'A','B','C','D','E') g.map(sns.distplot()) 回答1: I think you need to use melt to reshape your dataframe to long format, see this MVCE: df = pd.DataFrame(np.random.random((100,5)),