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

Change dispersion plot ylimit handling #107

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dgaines2
Copy link
Contributor

Problem:
In the case where a dispersion exhibits imaginary frequency modes or the user specifies bandmin, the current plotting workflow does not leave any visual room at the edge of the plot which can slightly cut off the band(s). All in all, not a big deal, but I think it's visually nicer to have a little margin.
Note: it seems that having a little margin was the default behavior before #104

Solution:
For add_dispersion() and add_projected_dispersion(), I removed the "else" condition and let matplotlib handle margin padding automatically.

For add_wideband(), I (manually) added matplotlib's default 5% margin padding to both the bottom and the top of the plot with two exceptions:

  1. There are no imaginary modes, in which case the bottom is left at 0.
  2. The user specifies ymin or ymax, in which case we use those values directly.

You can see a small change at the top of the plot-wideband example. The 5% margin might not actually be big enough in the cases where the phonon (physical) linewidths due to scattering are large, although this could be adjusted by passing ymax as an argument.

Further comments:
There might still be an issue for add_alt_dispersion() or add_alt_projected_dispersion() as I didn't have time to fully investigate these, but I figured I could at least start with this pull request as it is now. I'd be happy to make any changes or incorporate any feedback you might have!

In the case where a dispersion exhibits imaginary frequency modes or the
user specifes bandmin, the current logic sets the bottom ylim as the
minimum frequency of the data. Removing this else condition lets
matplotlib handle white space padding automatically in order to not cut
off the band(s).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant