Download Stack/Stack_21f3c1a50fb9e03f/code_edit.py from AIHero123/ChartM3: direct link, hf CLI and curl.
- Browser
- Download file 901 Bytes
-
https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_21f3c1a50fb9e03f/code_edit.py
- Command line
-
hf download hf://datasets/AIHero123/ChartM3/Stack/Stack_21f3c1a50fb9e03f/code_edit.py
-
curl -L -o code_edit.py https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_21f3c1a50fb9e03f/code_edit.py
901 Bytes
| import matplotlib.pyplot as plt | |
| # define the data | |
| days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] | |
| urban_steps = [8000, 7500, 9000, 8500, 9500, 10000, 9500] | |
| suburban_steps = [7000, 6500, 7500, 7000, 8000, 8500, 8000] | |
| rural_steps = [6000, 5500, 6500, 5000, 6500, 7000, 6500] | |
| # create stackplot | |
| stacks = plt.stackplot(days, urban_steps, suburban_steps, rural_steps, labels=['Urban','Suburban','Rural']) | |
| # modify the corresponding stack according to the instruction | |
| for idx, stack in enumerate(stacks): | |
| if idx in [1,2]: | |
| stack.set_linestyle('dashed') | |
| stack.set_edgecolor('#d341e1') | |
| # define title and axis labels | |
| plt.title('Average Daily Steps Taken By Individuals In Different Areas') | |
| plt.xlabel('Days of the Week') | |
| plt.ylabel('Number of Steps') | |
| # place a legend | |
| plt.legend(loc='upper left') | |
| plt.tight_layout() | |
| plt.savefig("Edit_figure.png") |