Simulation.viz_field_2D(monitor, sample_ind=0, normal=None, normal_ind=0, field='E', val='re', comp='z', ax=None, cbar=False, clim=None, cmap=None, eps_alpha=0.3, eps_freq=None)

Plot a 2D cross-section of a field stored in a Monitor.

  • monitor (Monitor) – The monitor to be queried.

  • sample_ind (int, optional) – Index of the frequency in a FreqMonitor or the time step in a TimeMonitor.

  • normal (None, optional) – Axis normal to the 2D plane of plotting. If None, the shortest dimension is taken as the normal.

  • normal_ind (int, optional) – Spatial index along the normal dimension, for 3D monitors.

  • field ({'E', 'H', 'S'}, optional) – Which field to plot.

  • val ({'re', 'im', 'abs', 'int'}, optional) – Plot the real part (default), or the imaginary part, or the absolute value of a field component, or the total field intensity.

  • comp ({'x', 'y', 'z'}, optional) – Component of the field to plot. If val is 'int', this parameter has no effect.

  • ax (Matplotlib axis object, optional) – If None, a new figure is created.

  • cbar (bool, optional) – Add a colorbar to the plot.

  • clim (List[float], optional) – Matplotlib color limit to use for plot.

  • cmap (Matplotlib colormap object) – Optional colormap to use, passed as image.set_cmap(cmap).

  • eps_alpha (float, optional) – If larger than zero, overlay the underlying relative permittivity distribution, with opacity defined by eps_alpha.

  • eps_freq (float or None, optional) – (Hz) frequency at which to query the permittivity. Should only be used for time monitors - for frequency monitors, the monitor frequency is used by default.


Return type

Matplotlib image object