Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(SCEM-3114): plot3d little polish #1032

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `web.abort()` and `Job.abort()` methods allowing to abort running tasks without deleting them. If a task is aborted, it cannot be restarted later, a new one needs to be created and submitted.

### Changed
- Add width and height options to Simulation.plot_3d

### Fixed

Expand Down
14 changes: 11 additions & 3 deletions tidy3d/components/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2257,9 +2257,17 @@ def frequency_range(self) -> FreqBound:

return (freq_min, freq_max)

def plot_3d(self) -> None:
"""Render 3D plot of ``Simulation`` (in jupyter notebook only)."""
return plot_sim_3d(self)
def plot_3d(self, width=800, height=800) -> None:
"""Render 3D plot of ``Simulation`` (in jupyter notebook only).
Parameters
----------
width : float = 800
width of the 3d view dom's size
height : float = 800
height of the 3d view dom's size

"""
return plot_sim_3d(self, width=width, height=height)

""" Discretization """

Expand Down
4 changes: 2 additions & 2 deletions tidy3d/components/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def polygon_patch(polygon, **kwargs):
================================================================================================="""


def plot_sim_3d(sim) -> None:
def plot_sim_3d(sim, width=800, height=800) -> None:
"""Make 3D display of simulation in ipyython notebook."""

try:
Expand Down Expand Up @@ -258,7 +258,7 @@ def plot_sim_3d(sim) -> None:
+ str(uuid)
)
html_code = f"""
<iframe id="simulation-viewer{uuid}" src={viewer_url} width="800" height="800"></iframe>
<iframe id="simulation-viewer{uuid}" src={viewer_url} width="{width}" height="{height}" allowfullscreen="true"></iframe>
<script>
{js_code}
</script>
Expand Down
Loading