From 31a5d7d16ab1b3e3632deb2b88249cba97113fe9 Mon Sep 17 00:00:00 2001 From: Jack Date: Fri, 29 Nov 2024 12:13:28 +0000 Subject: [PATCH] Added updated current vs time script --- .../plotting_scripts/plot_pulsed_current.py | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/documentation/proc-pages/scripts/plotting_scripts/plot_pulsed_current.py b/documentation/proc-pages/scripts/plotting_scripts/plot_pulsed_current.py index bd99af06..7d04ea25 100644 --- a/documentation/proc-pages/scripts/plotting_scripts/plot_pulsed_current.py +++ b/documentation/proc-pages/scripts/plotting_scripts/plot_pulsed_current.py @@ -1,21 +1,21 @@ import matplotlib.pyplot as plt # Define data points for each segment -x_red_blue = [0, 1, 2, 2.5, 5, 6] +x_red_blue = [0, 1, 2, 2.5, 5, 6] # x-coordinates for the red and blue dashed lines -y_red = [0, 3, 2.5, 2.5, 1.5, 0] # y-coordinates for the red solid line +y_red = [0, 3, 2.5, 2.5, 1.5, 0] # y-coordinates for the red dashed line y_blue = [0, 4, -2, -2, -3, 0] # y-coordinates for the blue dashed line -x_black = x_red_blue[1:] +x_black = x_red_blue[1:] # x-coordinates for the black solid line -y_black = [0, 3.5, 3.5, 3.5, 0] +y_black = [0, 3.5, 3.5, 3.5, 0] # y-coordinates for the black solid line # Create the figure and axis fig, ax = plt.subplots(figsize=(10, 6)) # Plot the PF coil current -ax.plot(x_red_blue, y_red, "r-", linewidth=2, label="PF coil") +ax.plot(x_red_blue, y_red, "r--", linewidth=2, label="PF coil") # Plot the central solenoid current ax.plot(x_red_blue, y_blue, "b--", linewidth=2, label="Central solenoid") @@ -23,12 +23,11 @@ # Plot the plasma current ax.plot(x_black, y_black, "black", linewidth=2, label="Plasma") -# ax.axhline(y=-0.005, color="black", linestyle="-") - +# Move the x-axis to 0 on the y-axis ax.spines["bottom"].set_position("zero") +# Adjust the axes limits to allow space for labels ax.set_xlim(0, 7.2) - ax.set_ylim(-3.5, 4.2) # Annotate key points @@ -72,7 +71,7 @@ xytext=(2, -3.2), arrowprops={"arrowstyle": "|-|", "shrinkA": 0, "shrinkB": 0}, ) -ax.annotate(r"$I_{\text{P}}$ Ramp-up", xy=(1.5, -3.4), ha="center", va="center") +ax.annotate(r"$I_{\text{P}}$ Ramp-Up", xy=(1.5, -3.4), ha="center", va="center") ax.annotate( "", xy=(2, -3.2), @@ -107,11 +106,12 @@ ax.xaxis.set_label_coords(0.97, 0.5) ax.set_ylabel("Current", fontsize=12) +# Remove axes ticks ax.set_xticklabels([]) ax.set_yticklabels([]) # Add a title -ax.set_title("Current Profiles over time", fontsize=14) +ax.set_title("Current Profiles Over Time", fontsize=14) # Add a legend ax.legend() @@ -121,5 +121,4 @@ # Adjust layout and display the plot plt.tight_layout() -plt.savefig("/testing/my_scripts/timings_plot.png") -# plt.show() +plt.savefig("/home/jg6173/testing/my_scripts/current_vs_time_plot.png")