Download Stack/Stack_45d184abaf3aa7b8/code_edit.py from AIHero123/ChartM3: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_45d184abaf3aa7b8/code_edit.py
- Command line
-
hf download hf://datasets/AIHero123/ChartM3/Stack/Stack_45d184abaf3aa7b8/code_edit.py
-
curl -L -o code_edit.py https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_45d184abaf3aa7b8/code_edit.py
1.26 kB
| import matplotlib.pyplot as plt | |
| # Define data for emojis | |
| emojis = ['😂 (Laughing Face)', '❤️ (Red Heart)', '😭 (Loudly Crying Face)'] | |
| time_intervals = ['12 PM', '1 PM', '2 PM', '3 PM', '4 PM', '5 PM', '6 PM', '7 PM', '8 PM', '9 PM', '10 PM', '11 PM', '12 AM'] | |
| emoji_data = { | |
| '😂 (Laughing Face)': [40, 35, 30, 25, 20, 25, 30, 35, 40, 45, 50, 45, 40], | |
| '❤️ (Red Heart)': [25, 30, 35, 40, 45, 40, 35, 30, 25, 20, 15, 20, 25], | |
| '😭 (Loudly Crying Face)': [15, 20, 25, 30, 35, 40, 45, 40, 35, 30, 25, 20, 15] | |
| } | |
| # Define colors for emojis | |
| emoji_colors = ['lightyellow', 'lightcoral', 'lightblue'] | |
| # Create stack plot with custom colors | |
| plt.figure(figsize=(10, 6)) | |
| stacks=plt.stackplot(time_intervals, [emoji_data[emoji] for emoji in emojis], labels=emojis, colors=emoji_colors) | |
| for idx,stack in enumerate(stacks): | |
| if idx in [1]: | |
| stack.set_hatch('o') | |
| stack.set_linestyle('dashed') | |
| stack.set_edgecolor('#b9b64c') | |
| # Customize plot | |
| plt.title("Emoji Frequency in Text Messages (Teenagers)") | |
| plt.xlabel("Time (12 PM - 12 AM)") | |
| plt.ylabel("Percentage of Text Messages with Emoji") | |
| plt.legend(loc='upper left') | |
| # Show plot | |
| plt.xticks(rotation=45) | |
| # plt.show() | |
| plt.tight_layout() | |
| plt.savefig("Edit_figure.png") |