20
votes
How to include labels in sns heatmap
I got your problem like this way:
You want to show labels on the x and y-axis on the seaborn heatmap. So for that, sns.heatmap() function has two parameters which ...
- 301
17
votes
Accepted
How to remove outliers using box-plot?
Seaborn uses inter-quartile range to detect the outliers. What you need to do is to reproduce the same function in the column you want to drop the outliers. It's quite easy to do in Pandas.
If we ...
- 3,840
15
votes
Accepted
seaborn heatmap not displaying correctly
Current version of matplotlib broke heatmaps. Downgrade the package to 3.1.0
pip install matplotlib==3.1.0
matplotlib/seaborn: first and last row cut in half of ...
- 166
14
votes
Accepted
Meaning of 'hue" in seaborn barplot
In seaborn, the hue parameter determines which column in the data frame should be used for colour encoding. Using the official document for ...
- 1,138
11
votes
How to deal with TypeError: ufunc 'isnan' not supported for the input types
There may be column of type object in your dataFrame. Remove it or convert it into float,int etc. if possible
From Documentation of Seaborn:
data : rectangular dataset
2D dataset that can be ...
- 111
11
votes
How to remove outliers using box-plot?
If you need to remove outliers and you need it to work with grouped data, without extra complications, just add showfliers argument as False in the function call. ...
- 263
9
votes
Accepted
What is the difference between regplot and lmplot in seaborn?
regplot() performs a simple linear regression model fit and plot. lmplot() combines regplot() and FacetGrid.
The FacetGrid class helps in visualizing the distribution of one variable as well as the ...
8
votes
How to include labels in sns heatmap
Here's how we can add simple X-Y labels in sns heatmap:
s = sns.heatmap(cm_train, annot=True, fmt='d', cmap='Blues')
s.set(xlabel='X-Axis', ylabel='Y-Axis')
OR
<...
- 81
8
votes
Accepted
Can we remove features that have zero-correlation with the target/label?
Can I drop these features to improve the accuracy of my classification problem?
If you are using a simple linear classifier, such as logistic regression then yes. That is because your plots are ...
- 28.1k
7
votes
Accepted
Stacked time series plot in python
You can simply use
df.plot.area()
Found here after a quick google search.
- 1,902
7
votes
seaborn heatmap not displaying correctly
I had the same problem, solved by moving y axis:
ax.set_ylim([0,2])
7
votes
Accepted
Plot Two Categorical Variables
Well, there are a few ways to do the job. Here are some I thought of:
Scatterplots with noise:
Normally, if you try to use a scatter plot to plot two categorical features, you would just get a few ...
- 198
6
votes
Accepted
How to show percentage (text) next to the horizontal bars in matplotlib?
Here is a working example to add a text to the right of horizontal bars:
...
- 8,987
6
votes
Seaborn Violin plot error No loop for unfunc add
I had tried the suggestion from @foxthatruns's answer to no avail. I found that changing my numeric column to float64 solved the problem (reference).
...
- 181
5
votes
Accepted
Checking for skewness in data
IIUC you can use [DataFrame.hist()] method:
...
4
votes
Can we remove features that have zero-correlation with the target/label?
These uncorrelated features might be important for target in connection with other non-target features. So, it might be not a good idea to remove them, especially if your model is a complex one.
It ...
- 497
4
votes
Can we remove features that have zero-correlation with the target/label?
If I understand you well, you are asking if you can remove features having zero-correlation either :
With other features
With the label you want to predict
Those are two different cases :
1. We ...
- 66
4
votes
Accepted
Why do seaborn.dist and pyplot.hist generate two different looking histograms on the same data?
The first returns a probability density of the distributions. As you can see, they integrate to 1, i.e. they cover the same area (because they are probabilities, not the raw data).
The second returns ...
- 5,897
3
votes
How can I change the transparency of a histogram plot in Seaborn using Pairgrid?
With a pandas dataframe, the following should do it without seaborn:
train_df.groupby('Embarked')['Fare'].plot.hist(alpha=0.5)
If you have to use seaborn you can ...
oW_♦
- 6,144
3
votes
Unable to generate error bars with seaborn
I found this question when trying to find a way to add my own precalculated, custom error bars (standard deviations) to a Seaborn barplot with grouped values. I finally managed to find a workaround... ...
- 31
3
votes
Unable to generate error bars with seaborn
Try this:
g = sns.barplot(y="algorithm", x="avg_weightedcost", hue="group",
xerr=df[std_weight]*1, capsize=.2, data=df)
Hope it helps
- 249
3
votes
Accepted
Making Inference from a Correlation Heatmap
Assuming you're using df.corr(), the results from a heatmap are Pearson correlation coefficients which can be thought of as "the explainability between two arrays." ...
- 180
3
votes
Accepted
Seaborn subplots massive whitespace
You can move the title closer to the first figure. Just add the following two lines at the end of the code
fig.tight_layout()
fig.subplots_adjust(top=0.95)
- 3,840
3
votes
How do I change the marker edge color of a seaborn relplot?
The issue was with the parameter I was using. The parameter "edgecolors" is incorrect. The correct parameter is the non-plural "edgecolor". So the correct call to relplot is:
...
3
votes
Accepted
Best way to visualize huge amount of data
I have three suggestions that may help.
Reduce the point size
Make the points highly transparent
Downsample the points
Since you do not provide any sample data, I will use some random data to ...
- 303
3
votes
Accepted
Seaborn distplot and KDE data confusion
The difference is caused by the fact that seaborn.distplot and matplotlib.pyplot.hist use different defaults for the number of ...
- 6,852
3
votes
Accepted
What does 'lm' mean in the lmplot() in seaborn?
"lm" = "linear model". As reported in the docs:
Plot data and regression model fits across a FacetGrid. [...] It is intended as a convenient interface to fit regression models across conditional ...
- 5,897
2
votes
What is the concept of error bars in barplots in seaborn library?
It appears that even if you don't enter ci argument, it's set to 95 by default in barplot ...
- 301
2
votes
How to extract numerical data from a matplotlib scatter plot in python?
You could also show the values for each point by using matplotlibs annotate command:
...
- 542
2
votes
Meaning of 'hue" in seaborn barplot
This is a good question but it seems none of the answers really answered the question.
Simply, in the HSL color system, hue is one of the properties of color which decides what kind of color it looks ...
- 121
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
seaborn × 92python × 41
visualization × 30
matplotlib × 30
pandas × 19
plotting × 15
python-3.x × 6
machine-learning × 5
numpy × 5
dataframe × 5
regression × 4
data × 4
heatmap × 4
clustering × 3
scikit-learn × 2
time-series × 2
statistics × 2
linear-regression × 2
data-cleaning × 2
k-means × 2
graphs × 2
distribution × 2
kaggle × 2
plotly × 2
histogram × 2