Skip to content

Commit

Permalink
Skip plotting line data if it's all NaNs
Browse files Browse the repository at this point in the history
  • Loading branch information
SolarDrew committed Jan 7, 2025
1 parent edbd777 commit a9e99ed
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ndcube/visualization/mpl_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def _plot_1D_cube(self, wcs, axes=None, axes_coordinates=None, axes_units=None,
# We plot against pixel coordinates
axes.errorbar(np.arange(len(ydata)), ydata, yerr=yerror, **kwargs)
else:
axes.plot(ydata, **kwargs)
if not np.isnan(ydata).all().compute():
axes.plot(ydata, **kwargs)

axes.set_ylabel(default_ylabel)

Expand Down

0 comments on commit a9e99ed

Please sign in to comment.