Skip to main content

Magnetic field variation

Here is the plot:

mag.png

Same trend to plot it:

#Plot magnometer X, Y,Z
plt.figure(figsize=(10,5))
plt.plot(df.index, df['mag_x'], label='Mag X')
plt.plot(df.index, df['mag_y'], label='Mag Y')
plt.plot(df.index, df['mag_z'], label='Mag Z')
plt.xlabel('Time of flight')
plt.ylabel('Magnetic field, microT')
plt.legend(loc='upper right')

# plt.xlim(1000,6500)
# plt.ylim(720,1100)

ax = plt.gca()  # Get the current Axes instance on the current figure
date_format = plt.matplotlib.dates.DateFormatter('%H:%M')  # Set format to hour:minute
ax.xaxis.set_major_formatter(date_format)

# Set x-axis limits to 2023-10-01 19:30 and 2023-10-01 21:15
start_datetime = pd.to_datetime('2022-11-09 19:30', format='%Y-%m-%d %H:%M')
end_datetime = pd.to_datetime('2022-11-09 21:15', format='%Y-%m-%d %H:%M')

ax.set_xlim(start_datetime, end_datetime)
ax.grid(axis='both', linestyle='--', linewidth=0.5)
plt.show()