Questions tagged [histplot]

30 questions
44
votes
2 answers

How To Plot Multiple Histograms On Same Plot With Seaborn

With matplotlib, I can make a histogram with two datasets on one plot (one next to the other, not overlay). import matplotlib.pyplot as plt import random x = [random.randrange(100) for i in range(100)] y = [random.randrange(100) for i in…
Malonge
  • 1,980
  • 5
  • 23
  • 33
17
votes
3 answers

Add KDE on to a histogram

I would like to add a density plot to my histogram diagram. I know something about pdf function but I've got confused and other similar questions were not helpful. from scipy.stats import * from numpy import* from matplotlib.pyplot import* from…
aaa
  • 161
  • 1
  • 1
  • 8
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
4
votes
1 answer

Overlaying a box plot or mean with error bars on a histogram

I am creating a histogram in Seaborn of my data in a pretty standard way, ie: rc = {'font.size': 32, 'axes.labelsize': 28.5, 'legend.fontsize': 32.0, 'axes.titlesize': 32, 'xtick.labelsize': 31, 'ytick.labelsize': 12} sns.set(style="ticks",…
r_movva
  • 41
  • 1
  • 3
3
votes
1 answer

How to add hatches to histplot bars and legend

I created a bar plot with hatches using seaborn. I was also able to add a legend that included the hatch styles, as shown in the MWE below: import matplotlib.pyplot as plt import seaborn as sns tips = sns.load_dataset("tips") hatches = ['\\\\',…
Ernesto
  • 187
  • 1
  • 8
3
votes
1 answer

How to change the number of bins in seaborn's pairplot() function?

I have a data set of 36000 rows and 51 columns. Each row is an observation and the first 50 columns are 50 different features of each observation. The 51th columns is one with values 0 or 1, where 0 means that the observation belongs to class A and…
thenac
  • 295
  • 6
  • 14
2
votes
1 answer

How to create a histogram with points rather than bars

I would like to plot a histplot but using points rather than bars. x_n10_p0_6 = binom.rvs(n=10, p=0.6, size=10000, random_state=0) x_n10_p0_8 = binom.rvs(n=10, p=0.8, size=10000, random_state=0) x_n20_p0_8 = binom.rvs(n=20, p=0.6, size=10000,…
Chris Snow
  • 23,813
  • 35
  • 144
  • 309
2
votes
1 answer

How to plot the difference between two histograms

I'm plotting two distributions as histplots, and would like to visualize the difference between them. The distributions are rather similar: The code I am using to generate one of these plots looks like this: sns.histplot( …
schadenfreude
  • 212
  • 4
  • 15
1
vote
2 answers

X values in a cumulative histogram in Python

I have a dataframe with values representing one item's correspondence with another item (by percentage), for example, the amount of characters in one string matching another string. Here is some sample…
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
3 answers

The color is not matching between two subplots & legend order

I'm struggling with two small formatting issues with my Seaborn boxplot and histogram (plotted as subplots). The colors between the two subplots are slightly different even though the coded colors are exactly the same. I'm trying to rearrange the…
KatC
  • 13
  • 3
1
vote
0 answers

Seaborn.histplot doesn't show full data with hue

I'm trying to use 'seaborn.histplot()' to show from which of the categorical 'Destination' data has been 'Transported'. df_train description sns.histplot(df_train, x='Destination',hue='Transported') this is the output as you can see, part of the the…
hadromi
  • 11
  • 2
1
vote
3 answers

How to change the color of individual bars in histplot

I was looking on internet but i didn't get any solution. I have this graph and I want to change the color of the first bar, if I use the parameter 'color' it changes all the bars. Is it possible to do this?
Fernanda
  • 25
  • 1
  • 4
1
vote
2 answers

How to use `multiple` parameter in seaborn.histplot

seaborn.histplot takes a keyword argument called multiple with one of {'layer', 'dodge', 'stack', 'fill'} values. I presume it handles how multiple bars overlap, or when hue is used. but, the examples and documentation doesn't make it clear on when…
Naveen Reddy Marthala
  • 2,622
  • 4
  • 35
  • 67
1
2