0

I'm trying to create a histoplot to show a certain column of my dataframe that I'm sure has values for every single integer going from 47 to 93 but when I plot it it leaves spaces every two values. I'm not sure if this is intended behavior and in case it is how I'd go about changing it?

sns.histplot(data['overall']) enter image description here

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158

1 Answers1

0

You can try setting bins to all the unique values:

data = pd.DataFrame({'overall' : [item for sublist in [[x]*x for x in range(1, 11)] for item in sublist]})
sns.histplot(data['overall'], bins=data['overall'].unique())

enter image description here

René
  • 4,594
  • 5
  • 23
  • 52
  • 2
    You don't need to pass both `bins` and `discrete`; `discrete` is a manner of setting the bins. – mwaskom Apr 29 '23 at 13:45