NanoComp / meep

free finite-difference time-domain (FDTD) software for electromagnetic simulations
GNU General Public License v2.0
1.17k stars 598 forks source link

Plot labels for geometric objects #2614

Closed Yaraslaut closed 9 months ago

Yaraslaut commented 11 months ago

At the moment plot can add additional labels to the figure, it will point out to sources and monitors It would be great if user can provide label for geometry entity so plot will shows this labels of the objects as well.

stevengj commented 11 months ago

I guess an interface for this would involve:

  1. add an optional string label field to GeometricObject (defaulting to "")
  2. add a labelgeometry=True flag to sim.plot2D, which would simply plot the given object labels (if any) at the (2d-projected) centers of the corresponding objects. (Or in 3d, maybe only plot them if they intersect the 2d slice.)

At first glance, it seems like it would be straightforward to implement and potentially quite handy, if someone wants to take a crack at it.

Yaraslaut commented 11 months ago

I can try to make a PR for this

oskooi commented 11 months ago
  1. add a labelgeometry=True flag to sim.plot2D, which would simply plot the given object labels (if any) at the (2d-projected) centers of the corresponding objects. (Or in 3d, maybe only plot them if they intersect the 2d slice.)

Following the naming conventions for method parameters, it would be good to use label_geometry rather than labelgeometry as the new parameter to sim.plot2D.