Download Stack/Stack_14f1f322983c9359/code_edit.py from AIHero123/ChartM3: direct link, hf CLI and curl.
- Browser
- Download file 926 Bytes
-
https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_14f1f322983c9359/code_edit.py
- Command line
-
hf download hf://datasets/AIHero123/ChartM3/Stack/Stack_14f1f322983c9359/code_edit.py
-
curl -L -o code_edit.py https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_14f1f322983c9359/code_edit.py
926 Bytes
| import matplotlib.pyplot as plt | |
| from matplotlib.transforms import Bbox | |
| # time intervals | |
| time_intervals = ['1', '2', '3', '4', '5'] | |
| # values for gas, stars, dust in each time interval | |
| gas = [100, 90, 85, 80, 75] | |
| stars = [50, 60, 55, 65, 70] | |
| dust = [20, 25, 30, 35, 40] | |
| plt.figure(figsize=(10,7)) | |
| # create stackplot | |
| plt.stackplot(time_intervals, gas, stars, dust, labels=['Gas','Stars','Dust'], colors=['blue','orange','green']) | |
| # Apply modifications to the 'Stars' stack | |
| clip_box = Bbox.from_bounds(121, 70, 232, 361) | |
| for i, area in enumerate(plt.gca().collections): | |
| if i == 1: # Stars' stack | |
| area.set_clip_box(clip_box) | |
| area.set_facecolor('#51dddd') | |
| plt.legend(loc='upper right') | |
| # labeling the axes | |
| plt.xlabel('Time Intervals') | |
| plt.ylabel('Units') | |
| # adding title to the plot | |
| plt.title('Dynamics of a Galactic Collision across Time Intervals') | |
| plt.tight_layout() | |
| plt.savefig("Edit_figure.png") |