Skip to content

Commit 8db9498

Browse files
committed
Make labels with math text raw strings since they behave better
1 parent 0bb3c26 commit 8db9498

File tree

1 file changed

+14
-14
lines changed
  • Examples/Tests/ohm_solver_ion_beam_instability

1 file changed

+14
-14
lines changed

Examples/Tests/ohm_solver_ion_beam_instability/analysis.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@
7070
# Colorbar
7171
fig.subplots_adjust(right=0.825)
7272
cbar_ax = fig.add_axes([0.85, 0.2, 0.03, 0.6])
73-
fig.colorbar(im, cax=cbar_ax, orientation="vertical", label="$B_y/B_0$")
73+
fig.colorbar(im, cax=cbar_ax, orientation="vertical", label=r"$B_y/B_0$")
7474

75-
ax1.set_xlabel("$x/l_i$")
76-
ax1.set_ylabel("$t \Omega_i$ (rad)")
75+
ax1.set_xlabel(r"$x/l_i$")
76+
ax1.set_ylabel(r"$t \Omega_i$ (rad)")
7777

7878
ax1.set_title(f"Ion beam R instability - {resonant_str} case")
7979
plt.savefig(
@@ -88,13 +88,13 @@
8888

8989
t_grid = np.arange(num_steps) * dt * sim.w_ci
9090
plt.plot(
91-
t_grid, np.abs(field_kt[:, 4] / sim.B0), "r", label=f"m = 4, $kl_i={k[4]:.2f}$"
91+
t_grid, np.abs(field_kt[:, 4] / sim.B0), "r", label=fr"m = 4, $kl_i={k[4]:.2f}$"
9292
)
9393
plt.plot(
94-
t_grid, np.abs(field_kt[:, 5] / sim.B0), "b", label=f"m = 5, $kl_i={k[5]:.2f}$"
94+
t_grid, np.abs(field_kt[:, 5] / sim.B0), "b", label=fr"m = 5, $kl_i={k[5]:.2f}$"
9595
)
9696
plt.plot(
97-
t_grid, np.abs(field_kt[:, 6] / sim.B0), "k", label=f"m = 6, $kl_i={k[6]:.2f}$"
97+
t_grid, np.abs(field_kt[:, 6] / sim.B0), "k", label=fr"m = 6, $kl_i={k[6]:.2f}$"
9898
)
9999

100100
# The theoretical growth rates for the 4th, 5th and 6th Fourier modes of
@@ -119,8 +119,8 @@
119119
plt.grid()
120120
plt.legend()
121121
plt.yscale("log")
122-
plt.ylabel("$|B_y/B_0|$")
123-
plt.xlabel("$t\Omega_i$ (rad)")
122+
plt.ylabel(r"$|B_y/B_0|$")
123+
plt.xlabel(r"$t\Omega_i$ (rad)")
124124
plt.tight_layout()
125125
plt.savefig(
126126
f"diags/ion_beam_R_instability_{resonant_str}_eta_{sim.eta}_substeps_{sim.substeps}_low_modes.png"
@@ -172,11 +172,11 @@
172172
fig.subplots_adjust(bottom=0.15, right=0.815)
173173
cbar_ax = fig.add_axes([0.83, 0.2, 0.03, 0.6])
174174
fig.colorbar(
175-
im[3], cax=cbar_ax, orientation="vertical", format="%.0e", label="$f(z, v_y)$"
175+
im[3], cax=cbar_ax, orientation="vertical", format="%.0e", label=r"$f(z, v_y)$"
176176
)
177177

178-
ax1.set_xlabel("$x/l_i$")
179-
ax1.set_ylabel("$v_{y}/v_A$")
178+
ax1.set_xlabel(r"$x/l_i$")
179+
ax1.set_ylabel(r"$v_{y}/v_A$")
180180

181181
ax1.set_title(f"Ion beam R instability - {resonant_str} case")
182182
plt.savefig(
@@ -207,11 +207,11 @@
207207
fig.subplots_adjust(bottom=0.15, right=0.815)
208208
cbar_ax = fig.add_axes([0.83, 0.2, 0.03, 0.6])
209209
fig.colorbar(
210-
im[3], cax=cbar_ax, orientation="vertical", format="%.0e", label="$f(z, v_y)$"
210+
im[3], cax=cbar_ax, orientation="vertical", format="%.0e", label=r"$f(z, v_y)$"
211211
)
212212

213-
ax1.set_xlabel("$x/l_i$")
214-
ax1.set_ylabel("$v_{y}/v_A$")
213+
ax1.set_xlabel(r"$x/l_i$")
214+
ax1.set_ylabel(r"$v_{y}/v_A$")
215215

216216
ax1.set_title(f"Ion beam R instability - {resonant_str} case")
217217
plt.savefig(

0 commit comments

Comments
 (0)