Download Stack/Stack_230fbf79f0226228/code.py from AIHero123/ChartM3: direct link, hf CLI and curl.
- Browser
- Download file 556 Bytes
-
https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_230fbf79f0226228/code.py
- Command line
-
hf download hf://datasets/AIHero123/ChartM3/Stack/Stack_230fbf79f0226228/code.py
-
curl -L -o code.py https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_230fbf79f0226228/code.py
556 Bytes
| import matplotlib.pyplot as plt | |
| # Age Group | |
| age_group = ['0-10', '11-20', '21-30', '31-40', '41-50', '51-60', '61-70'] | |
| # Males % | |
| males = [40, 45, 55, 48, 51, 46, 43] | |
| # Females % | |
| females = [60, 55, 45, 52, 49, 54, 57] | |
| plt.figure(figsize=(10,7)) | |
| # Stackplot | |
| plt.stackplot(age_group, males, females, colors=['blue', 'pink'], labels=['Males', 'Females']) | |
| plt.legend(loc='upper left') | |
| plt.title('Gender Distribution in Different Age Groups') | |
| plt.xlabel('Age Group') | |
| plt.ylabel('Percentage (%)') | |
| # plt.show() | |
| plt.tight_layout() | |
| plt.savefig("figure.png") |