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

add option to plot2D to plot contour of geometry rather than its image #1437

Merged
merged 4 commits into from
Nov 29, 2020

Conversation

oskooi
Copy link
Collaborator

@oskooi oskooi commented Nov 28, 2020

Fixes #1435.

Adds new options contour and contour_linewidth (for Matplotlib's contour) to eps_parameters of plot2D.

Documentation is also provided.

Example usage:

sim.plot2D(fields=mp.Hz,
           field_parameters={'alpha':1.0},
           eps_parameters={'contour':True},
           plot_sources_flag=True,
           plot_monitors_flag=True,
           plot_boundaries_flag=True)

demux_cw_fields_1 31um

For comparison, the default imshow rendering:

sim.plot2D(fields=mp.Hz,
           field_parameters={'alpha':0.7},
           plot_sources_flag=True,
	   plot_monitors_flag=True,
           plot_boundaries_flag=True)

demux_cw_fields_1 31um_imshow

@smartalecH
Copy link
Collaborator

Looks good on my end.

@oskooi
Copy link
Collaborator Author

oskooi commented Nov 29, 2020

Note that the origin keyword parameter of contour is set to lower by default which is different from imshow which is upper. The default origin value for contour must therefore be changed to upper for consistency.

@stevengj stevengj merged commit 7e5fc7f into NanoComp:master Nov 29, 2020
@oskooi oskooi deleted the plot2D_eps_contour branch November 29, 2020 01:41
bencbartlett pushed a commit to bencbartlett/meep that referenced this pull request Sep 9, 2021
NanoComp#1437)

* add option to plot2D to plot contour of geometry rather than its image

* tweak default parameters for contour plot

* set origin parameter of contour to 'upper' to be consistent with imshow

* update docs for contour and contour_linewidth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

overlaying fields on geometry contour using plot2D
3 participants