Questions tagged [displot]

These questions are for seaborn displot, which is a figure-level plot for hist, kde, and ecdf plots. When using this tag, also select the seaborn and python tags.

33 questions
15
votes
3 answers

Plotting a gaussian fit to a histogram in displot or histplot

How can I plot a gaussian fit onto a histplot, as previously done by the deprecated distplot? import seaborn as sns import numpy as np from scipy.stats import norm x = np.random.normal(size=500) * 0.1 With distplot I could do: sns.distplot(x,…
UserR6
  • 493
  • 7
  • 15
8
votes
3 answers

How to make a distplot for each column in a pandas dataframe

I 'm using Seaborn in a Jupyter notebook to plot histograms like this: import numpy as np import pandas as pd from pandas import DataFrame import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline df = pd.read_csv('CTG.csv',…
Marin Leontenko
  • 711
  • 2
  • 20
  • 26
7
votes
1 answer

Plot multiple distplot in seaborn Facetgrid

I have a dataframe which looks like below: df: RY MAJ_CAT Value 2016 Cause Unknown 0.00227 2016 Vegetation 0.04217 2016 Vegetation 0.04393 2016 Vegetation …
user2293224
  • 2,128
  • 5
  • 28
  • 52
4
votes
1 answer

How to set a different linestyle for each hue group in a kdeplot / displot

How can each hue group of a seaborn.kdeplot, or seaborn.displot with kind='kde' be given a different linestyle? Both axes-level and figure-level options will accept a str for linestyle/ls, which applies to all hue groups. import seaborn as…
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
4
votes
2 answers

How to draw a normal curve on seaborn displot

distplot was deprecated in favour of displot. The previous function had the option to draw a normal curve. import seaborn as sns import matplotlib.pyplot as plt from scipy import stats ax = sns.distplot(df.extracted, bins=40, kde=False,…
Borut Flis
  • 15,715
  • 30
  • 92
  • 119
4
votes
1 answer

How to change displot color saturation

I have installed the latest version of seaborn (0.11.1). When I plot a hist with custom color, it show different color than I expected (see the color by sns.palplot). For some api, it has a saturation parameter, but not for the…
Jack Chen
  • 59
  • 1
  • 4
3
votes
3 answers

Seaborn plot displot with hue and dual y-scale (twinx)

I am trying to plot the output from the predict of a ML model, there are the classes 1,0 for the Target, and the Score. Due the dataset is not balanced, there are few 1's. When I plot a simple displot with the Target in the hue parameter, the plot…
3
votes
1 answer

Plotting multiple seaborn displot

I am trying to create distplot of a dataframe grouped by a column data_plot = creditcard_df.copy() amount = data_plot['Amount'] data_plot.drop(labels=['Amount'], axis=1, inplace = True) data_plot.insert(0, 'Amount', amount) # Plot the distributions…
ola
  • 77
  • 1
  • 9
3
votes
1 answer

seaborn histplot and displot output doesn't match

Histograms generated by seaborn.histplot and seaborn.displot do not match. Default plot for sns.displot is kind='hist' Tested with python3.8.11, seaborn 0.11.2, and matplotlib 3.4.2 Why do the outputs not match, and how can this be resolved? The…
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
3
votes
2 answers

How to use hist_kws in seaborn displot

I want to plot histogram and kde line in the same plot with different color. I want to set green color for the histogram and blue color for the kde line. I managed to figure out using line_kws to change the kde line color but hist_kws is not working…
FeelBird
  • 35
  • 1
  • 5
2
votes
1 answer

How to change the histogram bar width in displot

I'm using seaborn's displot to get stacked bar charts. Here is my code: g = sns.displot(data=df, x='collection_year', hue='WB_Income group', multiple='stack',col="ena_species",col_wrap=6,facet_kws={'sharey': False, 'sharex': False}) and here is the…
Julio Diaz
  • 9,067
  • 19
  • 55
  • 70
2
votes
2 answers

How to plot histogram subplots for each group

When I run the following code, I get 4 different histograms separated by groups. How can I achieve the same type of visualization with 4 different sns.distplot() also separated by their groups? df = pd.DataFrame({ "group": [1, 1, 2, 2, 3, 3, 4,…
nerd
  • 473
  • 5
  • 15
1
vote
1 answer

How can I wrap subplot columns

I've been struggling with visualizing subplots column wrapping in Seaborn histogram plots (kdeplot, histplot). Tried various things including fig, ax & enumerate(zip(df.columns, ax.flatten()). Here's the dataset for col in df.columns: …
hanpat99
  • 17
  • 4
1
vote
1 answer

color parameter isn't changing the plot color

Following is the code that doesn't work. import numpy as np import pandas as pd import seaborn as sns sns.displot(pd.DataFrame(res), color='red', edgecolor=None, binwidth=.5, binrange=(3, 18+1)); res is a list type. I was expecting the bars to be…
Junho65
  • 15
  • 3
1
vote
2 answers

seaborn displot noting entire data

sns.displot(df,x='Age', col='Sex',kind='kde',multiple="stack") I want to express the gender distribution of all passengers with Titanic data. How do I display the total data of Male+Female on each gender graph? sns.displot(df,x='Age',…
holly
  • 11
  • 2
1
2 3