vault backup: 2025-12-12 13:06:31
This commit is contained in:
@@ -51,37 +51,30 @@ Ideen:
|
||||
|
||||
|
||||
```python
|
||||
from matplotlib.patches import Patch
|
||||
# Plot
|
||||
fig, ax = plt.subplots(figsize=(9,6))
|
||||
ax.plot(norm_x, norm_height, color='r')
|
||||
|
||||
colors = ['#0095D9','#F7EC59','#CBBE4A'] # Color Picker helps
|
||||
# filling under the curve
|
||||
ax.fill_between(x_percentile, y_percentile, 0, alpha=.5, color='#fa0000')
|
||||
|
||||
plt.pie(
|
||||
[0.8, 0.15, 0.05], # Try and Error ratios
|
||||
colors=colors,
|
||||
startangle=-55
|
||||
)
|
||||
|
||||
plt.legend(
|
||||
labels=["Sky", "Sunny side of pyramid", "Shady side of pyramid"],
|
||||
# Set right color and size for Patches
|
||||
handles=[Patch(facecolor=color) for color in colors],
|
||||
handlelength=1,
|
||||
handleheight=1,
|
||||
# Move Legend to the right
|
||||
loc="center left",
|
||||
bbox_to_anchor=(1, 0.5),
|
||||
fontsize=16,
|
||||
# Disable background and edge
|
||||
facecolor='none',
|
||||
edgecolor='none'
|
||||
)
|
||||
|
||||
plt.tight_layout() # Layout shouldnt Overflow
|
||||
# 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'
|
||||
)
|
||||
|
||||
# Show
|
||||
plt.title("Woman Height Normal Distribution")
|
||||
plt.xlabel("Height")
|
||||
plt.yticks([]) # hide y
|
||||
plt.show()
|
||||
```
|
||||
|
||||
|
||||
|
||||
$$\text{Birth Rate} = \frac{B}{P} * 1000$$
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user