Skip to content

Commit

Permalink
try fix ax.set_ylim in PhononDosPlotter.get_plot
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Nov 18, 2023
1 parent 2f50031 commit 59f0a89
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pymatgen/phonon/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,9 @@ def get_plot(
if ylim:
ax.set_ylim(ylim)
else:
_xlim = ax.set_xlim()
relevant_y = [p[1] for p in all_pts if _xlim[0] < p[0] < _xlim[1]]
if len(relevant_y) > 0:
ax.set_ylim((min(relevant_y), max(relevant_y)))
_xlim = ax.get_xlim()
relevant_y = [p[1] for p in all_pts if _xlim[0] < p[0] < _xlim[1]] or ax.get_ylim()
ax.set_ylim((min(relevant_y), max(relevant_y)))

ax.axvline(0, linewidth=2, color="black", linestyle="--")

Expand Down

0 comments on commit 59f0a89

Please sign in to comment.