-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Skip plotting line data if it's all NaNs #802
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Skip plotting line data if all values are NaN | ||
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -145,7 +145,9 @@ 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) | ||||||
# compute() will break on numpy arrays to catch dask arrays by casting to bool instead | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment should make more sense to those who aren't dask wonks ;) |
||||||
if not bool(np.isnan(ydata).all()): | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could something like
Suggested change
be used instead without causing dask problems? This way both NaN and Inf would be checked. In addition, it would check whether there are valid unmasked data because |
||||||
axes.plot(ydata, **kwargs) | ||||||
|
||||||
axes.set_ylabel(default_ylabel) | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.