Download Stack/Stack_2385c9b56ac61c0d/code_edit.py from AIHero123/ChartM3: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_2385c9b56ac61c0d/code_edit.py
- Command line
-
hf download hf://datasets/AIHero123/ChartM3/Stack/Stack_2385c9b56ac61c0d/code_edit.py
-
curl -L -o code_edit.py https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_2385c9b56ac61c0d/code_edit.py
1.06 kB
| import matplotlib.pyplot as plt | |
| import random | |
| from matplotlib.patheffects import SimplePatchShadow, Normal | |
| # Data | |
| months = [1, 2, 3, 4, 5, 6] | |
| facebook_users = [120, 110, 105, 95, 90, 85] | |
| twitter_users = [80, 85, 90, 95, 100, 105] | |
| instagram_users = [100, 105, 110, 115, 120, 125] | |
| # Stack plot | |
| plt.stackplot(months, facebook_users, twitter_users, instagram_users, | |
| labels=['Facebook', 'Twitter', 'Instagram'], | |
| colors=['blue', 'green', 'purple'], alpha=0.6) | |
| for i, area in enumerate(plt.gca().collections): | |
| if i == 1: # Twitter's stack | |
| area.set_zorder(18) | |
| shadow_color = 'purple' | |
| area.set_path_effects([SimplePatchShadow(offset=(2.83, 3.52), shadow_rgbFace=shadow_color), Normal()]) | |
| area.set_transform(plt.gca().transData) | |
| # X and Y labels | |
| plt.xlabel('Month') | |
| plt.ylabel('Number of Users (in millions)') | |
| # Title | |
| plt.title('User Trends of Social Media Platforms over Six Months') | |
| # Legend | |
| plt.legend(loc='upper left') | |
| # Display the plot | |
| plt.tight_layout() | |
| plt.savefig("Edit_figure.png") |