Skip to content

Commit

Permalink
πŸ› FIX: BandsData matplotlib with NaN values (#5024)
Browse files Browse the repository at this point in the history
Use `numpy.nanmin` and `numpy.nanmax` for computing y-limits.

Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>

Cherry-pick: d138842
  • Loading branch information
PhilippRue authored and sphuber committed Aug 9, 2021
1 parent 3df48bd commit b468b26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aiida/orm/nodes/data/array/bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,9 +784,9 @@ def _matplotlib_get_dict(

# axis limits
if y_max_lim is None:
y_max_lim = numpy.array(bands).max()
y_max_lim = numpy.nanmax(bands)
if y_min_lim is None:
y_min_lim = numpy.array(bands).min()
y_min_lim = numpy.nanmin(bands)
x_min_lim = min(x) # this isn't a numpy array, but a list
x_max_lim = max(x)
all_data['x_min_lim'] = x_min_lim
Expand Down

0 comments on commit b468b26

Please sign in to comment.