I have a df
named s
with just one column:
size
20
28
38
42
42
42
44
124
176
192
194
216
228
316
318
2048
2714
2802
4128
4186
6910
9313
10816
16560
20704
34766
91022
and I am plotting a histogram for the same using
sns.distplot(s['size'], bins = len(s))
and it yields a result as follows:
I would like to know how can I make a few changes:
I would like to know how can these 2 tasks be achieved.
Thanks
You're going to struggle getting the "Guassian look" you want given that this data is not normally distributed.
Using the size
column as counts is the closest you'd be able to get to the "Guassian look" you linked (if this is at all how your data can be interpreted).
import matplotlib.pyplot as plt
from io import StringIO
import pandas as pd
plt.style.use('seaborn')
data = pd.read_fwf(StringIO("""
20
28
38
42
42
42
44
124
176
192
194
216
228
316
318
2048
2714
2802
4128
4186
6910
9313
10816
16560
20704
34766
91022
"""), names=['size'], header=None)
plt.bar(range(data['size'].size), data['size'], width=1)
plt.xlabel('bin')
plt.ylabel('size')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.