Download Stack/Stack_53445ad8dbb6ffdb/code.py from AIHero123/ChartM3: direct link, hf CLI and curl.
- Browser
- Download file 590 Bytes
-
https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_53445ad8dbb6ffdb/code.py
- Command line
-
hf download hf://datasets/AIHero123/ChartM3/Stack/Stack_53445ad8dbb6ffdb/code.py
-
curl -L -o code.py https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_53445ad8dbb6ffdb/code.py
590 Bytes
| import matplotlib.pyplot as plt | |
| # Clusters | |
| clusters = [1, 2, 3] | |
| # Data Points | |
| blue_giants = [45, 60, 30] | |
| red_giants = [35, 25, 45] | |
| white_dwarfs = [20, 15, 25] | |
| # Plot | |
| fig, ax = plt.subplots() | |
| ax.stackplot(clusters, blue_giants, red_giants, white_dwarfs, labels=['Blue Giants','Red Giants','White Dwarfs'], alpha=0.7) | |
| # Labeling | |
| plt.title('Density mapping of Galactic Clusters based on stellar types') | |
| plt.xlabel('Clusters (1, 2, 3)') | |
| plt.ylabel('Density of Clusters') | |
| # Set the legend | |
| plt.legend(loc='upper left') | |
| # Display the stack plot | |
| plt.tight_layout() | |
| plt.savefig("figure.png") |