Skip to content

Commit

Permalink
magma/RdBu colormap set in sim_data.plot()
Browse files Browse the repository at this point in the history
  • Loading branch information
momchil-flex authored and tylerflex committed Jan 31, 2022
1 parent fe0c6cf commit 27d5029
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tidy3d/components/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ def plot_field( # pylint:disable=too-many-arguments, too-many-locals, too-many-
eps_alpha: float = 0.2,
robust: bool = True,
ax: Ax = None,
**kwargs,
**patch_kwargs,
) -> Ax:
"""Plot the field data for a monitor with simulation plot overlayed.
Expand Down Expand Up @@ -956,15 +956,20 @@ def plot_field( # pylint:disable=too-many-arguments, too-many-locals, too-many-
elif val == "abs":
field_data = abs(field_data)

if val=="abs" or field_name=="int":
cmap = "magma"
else:
cmap = "RdBu"

# plot the field
xy_coord_labels = list("xyz")
xy_coord_labels.pop(axis)
x_coord_label, y_coord_label = xy_coord_labels # pylint:disable=unbalanced-tuple-unpacking
field_data.plot(ax=ax, x=x_coord_label, y=y_coord_label, robust=robust)
field_data.plot(ax=ax, x=x_coord_label, y=y_coord_label, robust=robust, cmap=cmap)

# plot the simulation epsilon
ax = self.simulation.plot_structures_eps(
freq=freq, cbar=False, x=x, y=y, z=z, alpha=eps_alpha, ax=ax, **kwargs
freq=freq, cbar=False, x=x, y=y, z=z, alpha=eps_alpha, ax=ax, **patch_kwargs
)

# set the limits based on the xarray coordinates min and max
Expand Down

0 comments on commit 27d5029

Please sign in to comment.