Skip to content

Commit

Permalink
fix plotting bounds in plot_structures
Browse files Browse the repository at this point in the history
  • Loading branch information
dbochkov-flexcompute committed Feb 7, 2024
1 parent 398350f commit 6b5fb6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tidy3d/components/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,14 @@ def plot_structures(
for medium, shape in medium_shapes:
mat_index = medium_map[medium]
ax = self._plot_shape_structure(medium=medium, mat_index=mat_index, shape=shape, ax=ax)
ax = self._set_plot_bounds(bounds=self.bounds, ax=ax, x=x, y=y, z=z, hlim=hlim, vlim=vlim)

# clean up the axis display
axis, position = Box.parse_xyz_kwargs(x=x, y=y, z=z)
ax = self.box.add_ax_labels_lims(axis=axis, ax=ax)
ax.set_title(f"cross section at {'xyz'[axis]}={position:.2f}")

ax = self._set_plot_bounds(bounds=self.bounds, ax=ax, x=x, y=y, z=z, hlim=hlim, vlim=vlim)

return ax

def _plot_shape_structure(self, medium: Medium, mat_index: int, shape: Shapely, ax: Ax) -> Ax:
Expand Down Expand Up @@ -801,13 +802,14 @@ def plot_structures_eps(

if cbar:
self._add_cbar_eps(eps_min=eps_min, eps_max=eps_max, ax=ax)
ax = self._set_plot_bounds(bounds=self.bounds, ax=ax, x=x, y=y, z=z, hlim=hlim, vlim=vlim)

# clean up the axis display
axis, position = Box.parse_xyz_kwargs(x=x, y=y, z=z)
ax = self.box.add_ax_labels_lims(axis=axis, ax=ax)
ax.set_title(f"cross section at {'xyz'[axis]}={position:.2f}")

ax = self._set_plot_bounds(bounds=self.bounds, ax=ax, x=x, y=y, z=z, hlim=hlim, vlim=vlim)

return ax

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions tidy3d/components/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class Simulation(AbstractSimulation):
>>> from tidy3d import FieldMonitor, FluxMonitor
>>> from tidy3d import GridSpec, AutoGrid
>>> from tidy3d import BoundarySpec, Boundary
>>> from tidy3d import Medium
>>> sim = Simulation(
... size=(3.0, 3.0, 3.0),
... grid_spec=GridSpec(
Expand Down

0 comments on commit 6b5fb6b

Please sign in to comment.