Download Stack/Stack_5ec895ec0e1c75dd/code_edit.py from AIHero123/ChartM3: direct link, hf CLI and curl.
- Browser
- Download file 884 Bytes
-
https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_5ec895ec0e1c75dd/code_edit.py
- Command line
-
hf download hf://datasets/AIHero123/ChartM3/Stack/Stack_5ec895ec0e1c75dd/code_edit.py
-
curl -L -o code_edit.py https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_5ec895ec0e1c75dd/code_edit.py
884 Bytes
| import matplotlib.pyplot as plt | |
| from matplotlib.transforms import Bbox | |
| # Time Intervals | |
| time = [1, 2, 3, 4, 5] | |
| # Galactic Nebula Formation Stages | |
| gas_accumulation = [10, 15, 20, 25, 30] | |
| compression = [5, 10, 15, 20, 25] | |
| igniting_stars = [2, 5, 10, 15, 20] | |
| # Create a stackplot | |
| plt.stackplot(time, gas_accumulation, compression, igniting_stars, labels=['Gas Accumulation','Compression','Igniting Stars'], colors=['r','g','b']) | |
| clip_box = Bbox.from_bounds(190, 174, 187, 188) | |
| for i, area in enumerate(plt.gca().collections): | |
| if i == 1: # Compression's stack | |
| area.set_clip_box(clip_box) | |
| area.set_transform(plt.gca().transData) | |
| plt.xlabel('Time Intervals') | |
| plt.ylabel('Units') | |
| plt.title('Stages of Galactic Nebula Formation Simulation') | |
| # Add a legend | |
| plt.legend(loc='upper left') | |
| # Display the plot | |
| plt.tight_layout() | |
| plt.savefig("Edit_figure.png") |