'python probabilty of occurance histogram
I´m trying to write a script to get a histogram with a probability of occurrences/frequency on the y-axis. So far I have a script to plot a histogram without probability, but I´d like to divide the counts in each bin by the total amount of counts that are in the file (around 500k counts), any suggestions?
sns.set(style="whitegrid")
data = df['sample1']
data2 = df1['sample2']
plt.figure(figsize=(8,6))
plt.hist(data, bins=100, range=(-0.4,0.1), density = True, color = "lightgrey",edgecolor = "black") # , label="sample1"
plt.hist(data2, bins=100, range=(-0.4,0.1), density = True ,color="red", edgecolor = "black")# , label="sapmple2"
#straight dshed line
thresh = 0.0
plt.axvline(x=thresh, color='black', linestyle='--', linewidth=1.8)
plt.xlabel("Change ", size=14)
plt.ylabel("Count", size=14)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
