edmundsj / rcwa

Rigorous Coupled Wave Analysis for the calculation of Photonic Crystal R/T spectra
MIT License
93 stars 29 forks source link

Implement plot() method for all objects #47

Open edmundsj opened 2 years ago

edmundsj commented 2 years ago

It would be awesome if I could just call

LayerStack.plot()
Layer.plot()
Solver.plot()
Grating.plot()
Crystal.plot()
Source.plot()
Results.plot()

For 1D gratings, planar films, and LayerStacks, the output is unambiguous - it should return a cross-section along the axis of the lattice vector (if it exists). For 2D gratings, it should return a top view by default with the option to return a cross-sectional view along an arbitrary vector. Visualizing the solver should show everything (source and LayerStack).

They should return a fig, ax object pair and also be able to take these as arguments to plot multiple things on the same graph.

This is relatively straightforward and a substantial value-add for debugging and visualizing geometry.

edmundsj commented 2 years ago

Results.plot() has been implemented in a9f9e59e21a6d0c50cf836a6ede5a4d79823018d. It supersedes the Plotter class, which is now deprecated and will be removed in version 2.0.