Download Stack/Stack_5a7d19bf25d98861/code_edit.py from AIHero123/ChartM3: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_5a7d19bf25d98861/code_edit.py
- Command line
-
hf download hf://datasets/AIHero123/ChartM3/Stack/Stack_5a7d19bf25d98861/code_edit.py
-
curl -L -o code_edit.py https://huggingface.co/datasets/AIHero123/ChartM3/resolve/main/Stack/Stack_5a7d19bf25d98861/code_edit.py
1.15 kB
| import matplotlib.pyplot as plt | |
| # Depth measurements in meters | |
| point_A_depths = [200, 250, 300, 275, 320] | |
| point_B_depths = [150, 180, 200, 210, 190] | |
| point_C_depths = [300, 320, 350, 330, 310] | |
| point_D_depths = [180, 200, 220, 210, 190] | |
| point_E_depths = [250, 280, 300, 290, 270] | |
| # The order of the depth measurements | |
| depth_order = range(1, len(point_A_depths) + 1) | |
| # Create a new figure | |
| plt.figure() | |
| # Create a stack plot | |
| stacks = plt.stackplot(depth_order, point_A_depths, point_B_depths, point_C_depths, point_D_depths, point_E_depths, | |
| labels=['Point A', 'Point B', 'Point C', 'Point D', 'Point E']) | |
| # Set the linestyle and rasterized state for the target object | |
| for i, stack in enumerate(stacks): | |
| if i == 2: # Point C's stack | |
| stack.set_linestyle('dashdot') | |
| stack.set_edgecolor('yellow') | |
| stack.set_rasterized(True) | |
| # Set the title and labels | |
| plt.title("Ocean Depth Soundings along Marine Research Expedition") | |
| plt.xlabel("Order of Depth Measurements") | |
| plt.ylabel("Ocean Depths (meters)") | |
| # Add a legend | |
| plt.legend(loc='upper left') | |
| # Show the plot | |
| plt.tight_layout() | |
| plt.savefig("Edit_figure.png") |