Download Stack/Stack_42a68039396529e4/code.py from AIHero123/ChartM3: direct link, hf CLI and curl.
- Browser
- Download file 657 Bytes
-
https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_42a68039396529e4/code.py
- Command line
-
hf download hf://datasets/AIHero123/ChartM3/Stack/Stack_42a68039396529e4/code.py
-
curl -L -o code.py https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_42a68039396529e4/code.py
657 Bytes
| import matplotlib.pyplot as plt | |
| # Survey Participants | |
| participants = ['Participant 1', 'Participant 2', 'Participant 3', 'Participant 4', 'Participant 5'] | |
| # Cat owners' happiness levels | |
| cat_owners_happiness = [7, 5, 8, 6, 7] | |
| # Dog owners' happiness levels | |
| dog_owners_happiness = [9, 8, 7, 6, 8] | |
| fig, ax = plt.subplots() | |
| ax.stackplot(participants, cat_owners_happiness, dog_owners_happiness, labels=['Cat Owners','Dog Owners'], colors=['blue', 'orange']) | |
| ax.legend(loc='upper left') | |
| plt.xlabel("Survey Participants") | |
| plt.ylabel("Happiness Levels") | |
| plt.title("Happiness stack plot of Cat owners vs Dog owners") | |
| plt.tight_layout() | |
| plt.savefig("figure.png") |