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

Bug fix #101

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 47 additions & 3 deletions tp/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1549,13 +1549,15 @@ def kappa_target(transport_file, zt, direction, interpolate, kind, colour,
@fill_options

@legend_function(toggle=False)
@axes_limit_function()
@plot_io_function('tp-phonons')

def converge_phonons(band_yaml, bandmin, bandmax, colour, alpha, linestyle,
marker, xmarkcolour, xmarklinestyle, dos, poscar, atoms,
projected, sigma, total, total_label, total_colour,
doscolour, fill, fillalpha, line, label, legend_title,
location, style, large, save, show, extension, output):
location, xmin, xmax, ymin, ymax, style, large, save, show,
extension, output):
"""Plots and overlays phonon dispersions.

Can have optional DoS on the side.
Expand Down Expand Up @@ -1605,6 +1607,30 @@ def converge_phonons(band_yaml, bandmin, bandmax, colour, alpha, linestyle,
totalcolour=total_colour, fill=fill,
fillalpha=fillalpha, line=line, invert=True)
dosax.set_ylim(ax.get_ylim())

if xmin is not None:
if xmax is not None:
ax.set_xlim(xmin, xmax)
else:
ax.set_xlim(left=xmin)
elif xmax is not None:
ax.set_xlim(right=xmax)

if ymin is not None:
if ymax is not None:
ax.set_ylim(ymin, ymax)
if dos is not None:
dosax.set_ylim(ymin, ymax)
else:
ax.set_ylim(bottom=ymin)
if dos is not None:
dosax.set_ylim(bottom=ymin)
elif ymax is not None:
ax.set_ylim(top=ymax)
if dos is not None:
dosax.set_ylim(top=ymax)

if dos is not None:
tp.plot.utilities.set_locators(dosax, dos=True)

if label != [None] or dos is not None:
Expand Down Expand Up @@ -2198,11 +2224,13 @@ def waterfall(kappa_hdf5, y, x, projected, direction, temperature, colour, alpha
default=5,
show_default=True)

@axes_limit_function()
@plot_io_function('tp-wideband')
@verbose_option

def wideband(band_yaml, kappa_hdf5, temperature, poscar, colour, smoothing, style,
large, save, show, extension, output, verbose):
def wideband(band_yaml, kappa_hdf5, temperature, poscar, colour, smoothing,
style, xmin, xmax, ymin, ymax, large, save, show, extension,
output, verbose):
"""Plots a broadened phonon dispersion."""

axes = tp.axes.large if large else tp.axes.small
Expand All @@ -2220,6 +2248,22 @@ def wideband(band_yaml, kappa_hdf5, temperature, poscar, colour, smoothing, styl
poscar=poscar, smoothing=smoothing,
colour=colour, verbose=verbose)

if xmin is not None:
if xmax is not None:
ax.set_xlim(xmin, xmax)
else:
ax.set_xlim(left=xmin)
elif xmax is not None:
ax.set_xlim(right=xmax)

if ymin is not None:
if ymax is not None:
ax.set_ylim(ymin, ymax)
else:
ax.set_ylim(bottom=ymin)
elif ymax is not None:
ax.set_ylim(top=ymax)

if save:
for ext in extension:
fig.savefig('{}.{}'.format(output, ext))
Expand Down
Loading