Download Stack/Stack_365ff98a69a1841a/code_edit.py from AIHero123/ChartM3: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_365ff98a69a1841a/code_edit.py
- Command line
-
hf download hf://datasets/AIHero123/ChartM3/Stack/Stack_365ff98a69a1841a/code_edit.py
-
curl -L -o code_edit.py https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_365ff98a69a1841a/code_edit.py
1.11 kB
| import matplotlib.pyplot as plt | |
| import matplotlib.patheffects as path_effects | |
| from random import choice | |
| # List of industries | |
| industries = ['Education', 'Healthcare', 'Technology', 'Manufacturing', 'Retail'] | |
| # Corresponding unemployment rate values | |
| unemployment_rate = [6.5, 5.8, 4.2, 7.3, 8.1] | |
| # Corresponding income inequality index values | |
| income_inequality_index = [0.15, 0.25, 0.45, 0.35, 0.6] | |
| # Creating stack plot | |
| plt.figure(figsize=(10,7)) | |
| plt.stackplot(industries, unemployment_rate, income_inequality_index, labels=['Unemployment Rate', 'Income Inequality Index'], colors=['blue', 'orange']) | |
| for i, area in enumerate(plt.gca().collections): | |
| if i == 1: # Income Inequality Index's stack | |
| area.set_visible(False) | |
| area.set_zorder(9) | |
| # Adding legend | |
| plt.legend(loc='upper left') | |
| # Setting labels for the axes | |
| plt.xlabel('Industries') | |
| plt.ylabel('Percentage/Index') | |
| # Setting title for the plot | |
| plt.title('Stack Plot of Unemployment Rate and Income Inequality Index Across Different Industries') | |
| # Display the plot | |
| plt.tight_layout() | |
| plt.savefig("Edit_figure.png") | |