From 7c5394fcd851127a4b3db7b446e7559b94318300 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Thu, 13 Apr 2023 13:33:40 -0400 Subject: [PATCH] fix setting display units for unitless data --- jdaviz/configs/specviz/plugins/viewers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jdaviz/configs/specviz/plugins/viewers.py b/jdaviz/configs/specviz/plugins/viewers.py index a917fb4578..e8b0552c92 100644 --- a/jdaviz/configs/specviz/plugins/viewers.py +++ b/jdaviz/configs/specviz/plugins/viewers.py @@ -361,8 +361,10 @@ def add_data(self, data, color=None, alpha=None, **layer_state): result = super().add_data(data, color, alpha, **layer_state) if reset_plot_axes: - self.state.x_display_unit = data.get_component(self.state.x_att.label).units - self.state.y_display_unit = data.get_component("flux").units + x_units = data.get_component(self.state.x_att.label).units + y_units = data.get_component("flux").units + self.state.x_display_unit = x_units if x_units else None + self.state.y_display_unit = y_units if y_units else None self.set_plot_axes() self._plot_uncertainties()