Download Stack/Stack_596d9b49d88981f1/code.py from AIHero123/ChartM3: direct link, hf CLI and curl.
- Browser
- Download file 620 Bytes
-
https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_596d9b49d88981f1/code.py
- Command line
-
hf download hf://datasets/AIHero123/ChartM3/Stack/Stack_596d9b49d88981f1/code.py
-
curl -L -o code.py https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_596d9b49d88981f1/code.py
620 Bytes
| import matplotlib.pyplot as plt | |
| # Time periods of the day | |
| time_periods = ['Morning', 'Afternoon', 'Evening'] | |
| # Vehicle type counts for each time period | |
| cars = [50, 80, 60] | |
| buses = [5, 10, 8] | |
| bicycles = [15, 20, 25] | |
| # Stack plot for the vehicle distribution | |
| plt.figure(figsize=(7, 5)) | |
| plt.stackplot(time_periods, cars, buses, bicycles, labels=['Cars', 'Buses', 'Bicycles'], alpha=0.7) | |
| # Aesthetics for plot | |
| plt.legend(loc='upper left') | |
| plt.title("City Traffic Flow Analysis at Intersections") | |
| plt.xlabel("Time of the day") | |
| plt.ylabel("Count of vehicles") | |
| # Show the plot | |
| plt.tight_layout() | |
| plt.savefig("figure.png") |