Download Stack/Stack_494dfb2d44769e0f/code_edit.py from AIHero123/ChartM3: direct link, hf CLI and curl.
- Browser
- Download file 906 Bytes
-
https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_494dfb2d44769e0f/code_edit.py
- Command line
-
hf download hf://datasets/AIHero123/ChartM3/Stack/Stack_494dfb2d44769e0f/code_edit.py
-
curl -L -o code_edit.py https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_494dfb2d44769e0f/code_edit.py
906 Bytes
| import matplotlib.pyplot as plt | |
| # List of months | |
| months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September'] | |
| # Lists of vaccination rates for each country | |
| country_a = [5, 12, 20, 33, 48, 60, 68, 75, 80] | |
| country_b = [3, 6, 10, 18, 24, 38, 52, 65, 72] | |
| country_c = [12, 22, 30, 40, 55, 65, 75, 80, 85] | |
| plt.stackplot(months, country_a, country_b, country_c, labels=['Country A','Country B','Country C']) | |
| # Adding plot title and labels | |
| plt.title('COVID-19 Vaccination Rates by Country') | |
| plt.xlabel('Months') | |
| plt.ylabel('Vaccination Rate') | |
| # Adding legend | |
| plt.legend(loc='upper left') | |
| # Modifying the animated and rasterized state of the target object | |
| for i, area in enumerate(plt.gca().collections): | |
| if i == 1 or i==2: # Country B's stack | |
| area.set_animated(True) | |
| # Showing the plot | |
| # plt.show() | |
| plt.tight_layout() | |
| plt.savefig("Edit_figure.png") |