Skip to content

Commit f94f607

Browse files
FilipeFcpyaugenst-flex
authored andcommitted
feat: Add custom color-scale limits to Simulation.plot_eps via eps_lim
1 parent 3a9ec06 commit f94f607

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Added `eps_lim` keyword argument to `Simulation.plot_eps()` for manual control over the permittivity color limits.
13+
1014
## [2.8.4] - 2025-05-15
1115

1216
### Added

tidy3d/components/simulation.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ def plot_eps(
541541
vlim: Tuple[float, float] = None,
542542
ax: Ax = None,
543543
eps_component: Optional[PermittivityComponent] = None,
544+
eps_lim: Tuple[Union[float, None], Union[float, None]] = (None, None),
544545
) -> Ax:
545546
"""Plot each of simulation's components on a plane defined by one nonzero x,y,z coordinate.
546547
The permittivity is plotted in grayscale based on its value at the specified frequency.
@@ -577,6 +578,8 @@ def plot_eps(
577578
Component of the permittivity tensor to plot for anisotropic materials,
578579
e.g. ``"xx"``, ``"yy"``, ``"zz"``, ``"xy"``, ``"yz"``, ...
579580
Defaults to ``None``, which returns the average of the diagonal values.
581+
eps_lim : Tuple[float, float] = None
582+
Custom limits for eps coloring.
580583
581584
Returns
582585
-------
@@ -614,6 +617,7 @@ def plot_eps(
614617
hlim=hlim,
615618
vlim=vlim,
616619
eps_component=eps_component,
620+
eps_lim=eps_lim,
617621
)
618622
ax = self.plot_sources(ax=ax, x=x, y=y, z=z, hlim=hlim, vlim=vlim, alpha=source_alpha)
619623
ax = self.plot_monitors(ax=ax, x=x, y=y, z=z, hlim=hlim, vlim=vlim, alpha=monitor_alpha)
@@ -643,6 +647,7 @@ def plot_structures_eps(
643647
hlim: Tuple[float, float] = None,
644648
vlim: Tuple[float, float] = None,
645649
eps_component: Optional[PermittivityComponent] = None,
650+
eps_lim: Tuple[Union[float, None], Union[float, None]] = (None, None),
646651
) -> Ax:
647652
"""Plot each of simulation's structures on a plane defined by one nonzero x,y,z coordinate.
648653
The permittivity is plotted in grayscale based on its value at the specified frequency.
@@ -678,6 +683,8 @@ def plot_structures_eps(
678683
Component of the permittivity tensor to plot for anisotropic materials,
679684
e.g. ``"xx"``, ``"yy"``, ``"zz"``, ``"xy"``, ``"yz"``, ...
680685
Defaults to ``None``, which returns the average of the diagonal values.
686+
eps_lim : Tuple[float, float] = None
687+
Custom limits for eps coloring.
681688
682689
Returns
683690
-------
@@ -713,6 +720,7 @@ def plot_structures_eps(
713720
grid=self.grid,
714721
reverse=reverse,
715722
eps_component=eps_component,
723+
eps_lim=eps_lim,
716724
)
717725

718726
@equal_aspect

0 commit comments

Comments
 (0)