Download Stack/Stack_5a8d6522122e9abf/code_edit.py from AIHero123/ChartM3: direct link, hf CLI and curl.
- Browser
- Download file 933 Bytes
-
https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_5a8d6522122e9abf/code_edit.py
- Command line
-
hf download hf://datasets/AIHero123/ChartM3/Stack/Stack_5a8d6522122e9abf/code_edit.py
-
curl -L -o code_edit.py https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_5a8d6522122e9abf/code_edit.py
933 Bytes
| import matplotlib.pyplot as plt | |
| countries = ['Country A', 'Country B', 'Country C', 'Country D', 'Country E'] | |
| soccer = [20, 15, 10, 12, 8] | |
| basketball = [8, 10, 5, 6, 7] | |
| cricket = [5, 3, 6, 8, 4] | |
| tennis = [2, 3, 4, 1, 5] | |
| baseball = [3, 2, 1, 4, 1.5] | |
| plt.figure(figsize=(10,7)) | |
| stacks=plt.stackplot(countries, soccer, basketball, cricket, tennis, baseball, | |
| colors=['blue', 'orange', 'green', 'red', 'purple'], | |
| labels=['Soccer', 'Basketball', 'Cricket', 'Tennis', 'Baseball']) | |
| for idx,stack in enumerate(stacks): | |
| if idx in [2]: | |
| stack.set_linewidth(2.208110215281476) | |
| stack.set_edgecolor('#2de614') | |
| stack.set_linestyle('dashdot') | |
| stack.set_edgecolor('#0a14ac') | |
| plt.legend(loc='upper left') | |
| plt.title('Number of sports fanatics by country') | |
| plt.xlabel('Country') | |
| plt.ylabel('Number of sports fanatics (in millions)') | |
| plt.tight_layout() | |
| plt.savefig("Edit_figure.png") |