vault backup: 2025-12-19 12:52:14
This commit is contained in:
@@ -51,27 +51,26 @@ Ideen:
|
||||
|
||||
|
||||
```python
|
||||
# Plot
|
||||
fig, ax = plt.subplots(figsize=(9,6))
|
||||
ax.plot(norm_x, norm_height, color='r')
|
||||
|
||||
# filling under the curve
|
||||
ax.fill_between(x_percentile, y_percentile, 0, alpha=.5, color='#fa0000')
|
||||
gain_week = [
|
||||
rand.uniform(-2.5, 2.5, sims)
|
||||
for _ in range(7)
|
||||
]
|
||||
|
||||
|
||||
# Set text
|
||||
ax.text(0.4,0.18,
|
||||
f"80th percentile of Womens heigth\n fall under {avg_percentile:.1f}cm",
|
||||
ha='center', va='center', transform=ax.transAxes,
|
||||
bbox={'facecolor':'#fafafa','alpha':1,'edgecolor':'none','pad':1},
|
||||
color='#de2e0b'
|
||||
)
|
||||
duration = np.zeros(sims)
|
||||
for gain in gain_week:
|
||||
duration += gain
|
||||
duration += men
|
||||
|
||||
# Show
|
||||
plt.title("Woman Height Normal Distribution")
|
||||
plt.xlabel("Height")
|
||||
plt.yticks([]) # hide y
|
||||
gain_percent = float(
|
||||
np.round((duration < avg_weight-3).sum()/sims, decimals=2)
|
||||
)
|
||||
|
||||
plt.figure(figsize=(10,5))
|
||||
plt.hist(duration, density=True)
|
||||
plt.axvline(avg_weight-3, color='r')
|
||||
plt.show()
|
||||
print(gain_percent)
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user