@@ -118,20 +118,22 @@ def get_theoretical_field( field, t ):
118118
119119# Plot the last field from the loop (Ez at iteration 40)
120120fig , (ax1 , ax2 ) = plt .subplots (1 , 2 , dpi = 100 )
121- vmin = min (E_sim .min (), E_th .min ())
122- vmax = max (E_sim .max (), E_th .max ())
123- # First plot
121+ # First plot (slice at y=0)
122+ E_plot = E_sim [:,Ncell [1 ]// 2 + 1 ,:]
123+ vmin = E_plot .min ()
124+ vmax = E_plot .max ()
124125cax1 = make_axes_locatable (ax1 ).append_axes ('right' , size = '5%' , pad = '5%' )
125- # Plot slice at y=0
126- im1 = ax1 .imshow (E_sim [:,Ncell [1 ]// 2 + 1 ,:], origin = 'lower' , extent = edge , vmin = vmin , vmax = vmax )
126+ im1 = ax1 .imshow (E_plot , origin = 'lower' , extent = edge , vmin = vmin , vmax = vmax )
127127cb1 = fig .colorbar (im1 , cax = cax1 )
128128ax1 .set_xlabel (r'$z$' )
129129ax1 .set_ylabel (r'$x$' )
130130ax1 .set_title (r'$E_z$ (sim)' )
131- # Second plot
131+ # Second plot (slice at y=0)
132+ E_plot = E_th [:,Ncell [1 ]// 2 + 1 ,:]
133+ vmin = E_plot .min ()
134+ vmax = E_plot .max ()
132135cax2 = make_axes_locatable (ax2 ).append_axes ('right' , size = '5%' , pad = '5%' )
133- # Plot slice at y=0
134- im2 = ax2 .imshow (E_th [:,Ncell [1 ]// 2 + 1 ,:], origin = 'lower' , extent = edge , vmin = vmin , vmax = vmax )
136+ im2 = ax2 .imshow (E_plot , origin = 'lower' , extent = edge , vmin = vmin , vmax = vmax )
135137cb2 = fig .colorbar (im2 , cax = cax2 )
136138ax2 .set_xlabel (r'$z$' )
137139ax2 .set_ylabel (r'$x$' )
0 commit comments