tidy3d icon indicating copy to clipboard operation
tidy3d copied to clipboard

Add option to transpose plot

Open tylerflex opened this issue 1 year ago • 1 comments

by default, plotting on a plane puts the lowest transverse dimension (in 'xyz') on the x axis and the highest on the y axis.

It would be useful to be able to switch this convention with an extra kwarg transpose: bool = False passed to Simulation.plot(), which would flip this convention.

Sim.plot(x=0) # yz plot
Sim.plot(x=0, transpose=False) # also yz plot
Sim.plot(x=0, transpose=True)  # zy plot
image

Notes:

  • [ ] should also be applied to Simulation.plot_eps()
  • [ ] This notebook can be useful for additional testing.
  • [ ] Be careful to ensure that the hlim and vlim arguments are applied to the transposed dimensions.

Deliverables:

  • [ ] PR into develop including
    • [ ] the front end code changes
    • [ ] a test that adds a transpose=True in a simulation plotting, eg in tests/test_components/test_simulation.py
    • [ ] a line in the changelog under "added" explaining what is done.

Notes:

  • [ ] We use git rebase to ensure that there's a linear history, so the feature branch ideally should be rebased against develop and squashed into a single commit.
  • [ ] For testing and formatting
    • [ ] To get everything needed, from the root level of the tidy3d directory, run `pip install -e ".[dev]".
    • [ ] Our code formatting and listing is done with ruff and black. black . and ruff check tidy3d
    • [ ] Our tests can be run with pytest tests, more info here: https://github.com/flexcompute/tidy3d/blob/develop/tests/README.md

tylerflex avatar Aug 16 '23 16:08 tylerflex

@m-bone since you've already been digging in the plotting code a bit, can you take this one on as well? Could be a good 2nd warmup for our development flow so you can get a little more practice. hopefully the code bits are pretty minor. Thanks!

tylerflex avatar Jun 10 '24 16:06 tylerflex