0

I am trying to plot a histogram for data pa.

I wrote a code:

pa = np.array(pa)
scale = l ** 2
pa /= scale

fig, ax = plt.subplots()
hist = sns.histplot(pa, kde=True)

plt.grid(True)
plt.show()

The problem is that it whatever I do with pa data (scaling or not) the histogram looks the same.

I want to scale it, so the maximum possible value is 1.

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
Michal
  • 23
  • 6

1 Answers1

2

Depending on your usecase you might want to set the stat in the histplot function. See the documentation.

The default is 'count' but you probably want 'percent' or 'frequency' (or 'proportion')

try:


pa = np.array(pa)
scale = l ** 2
pa /= scale

fig, ax = plt.subplots()
hist = sns.histplot(pa, kde=True, stat='percent')

plt.grid(True)
plt.show()
Helmut
  • 311
  • 1
  • 9