fdtdx.plot_material

Contents

fdtdx.plot_material#

fdtdx.plot_material(config, arrays, filename=None, axs=None, plot_legend=True, positions=(0.0, 0.0, 0.0), type='permittivity', material_axis=0)[source]#

Creates a visualization of material distribution showing slices in XY, XZ and YZ planes.

Generates three subplots showing 2D slices of the material distribution (permittivity or permeability) through the 3D simulation volume at specified positions.

Parameters:
  • config (SimulationConfig) – Configuration object containing simulation parameters like resolution

  • arrays (ArrayContainer) – Container holding the material arrays (permittivity, permeability)

  • filename (str | Path | None, optional) – If provided, saves the plot to this file instead of displaying

  • axs (Any | None, optional) – Optional matplotlib axes to plot on. If None, creates new figure

  • plot_legend (bool, optional) – Whether to add colorbar legends

  • positions (tuple[float, float, float], optional) – Positions of slices in x, y, z directions (in meters). Zero means at center, 1e-6 would mean center+1µm

  • type (MaterialType, optional) – Type of material to plot, either “permittivity” or “permeability”

  • material_axis (int, optional) – Which component axis to plot (0, 1, or 2 for x, y, z components). For anisotropic materials this selects the diagonal element. Default is 0.

Returns:

The generated figure object

Return type:

Figure

Note

The plots show material values in 2D cross-sections, with positions in micrometers.