From 46033569b5cb94d96af4ac6ac94d3180ceeb5eb2 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Mon, 23 Oct 2023 09:37:33 -0400 Subject: [PATCH] plot options support for line in scatter viewer (#2449) * enable plot options for line in a scatter viewer * improved visibility/ordering - line_visible for scatters doesn't toggle the entire layer, but marker_scatter does, so instead the switch is moved to the line section (but for profile viewers, it is left in the "layers" section) --- CHANGES.rst | 2 ++ .../plugins/plot_options/plot_options.py | 4 +-- .../plugins/plot_options/plot_options.vue | 27 ++++++++++++------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 187cea1255..b5224d3bec 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -81,6 +81,8 @@ Other Changes and Additions - Add swatches to color picker. [#2494] +- Plot options now includes better support for scatter viewers, including toggling line visibility. [#2449] + 3.7.1 (unreleased) ================== diff --git a/jdaviz/configs/default/plugins/plot_options/plot_options.py b/jdaviz/configs/default/plugins/plot_options/plot_options.py index ae40a8c243..bdc19b581b 100644 --- a/jdaviz/configs/default/plugins/plot_options/plot_options.py +++ b/jdaviz/configs/default/plugins/plot_options/plot_options.py @@ -312,10 +312,9 @@ def state_attr_for_line_visible(state): return 'visible' # Profile/line viewer/layer options: - # TODO: once lines are supported in ScatterViewer, update state_filter to supports_line self.line_visible = PlotOptionsSyncState(self, self.viewer, self.layer, state_attr_for_line_visible, # noqa 'line_visible_value', 'line_visible_sync', - state_filter=is_profile) + state_filter=supports_line) self.collapse_function = PlotOptionsSyncState(self, self.viewer, self.layer, 'function', 'collapse_func_value', 'collapse_func_sync') self.line_color = PlotOptionsSyncState(self, self.viewer, self.layer, 'color', @@ -333,6 +332,7 @@ def state_attr_for_line_visible(state): 'uncertainty_visible_value', 'uncertainty_visible_sync') # noqa # Scatter/marker options: + # NOTE: marker_visible hides the entire layer (including the line) self.marker_visible = PlotOptionsSyncState(self, self.viewer, self.layer, 'visible', 'marker_visible_value', 'marker_visible_sync', state_filter=is_scatter) diff --git a/jdaviz/configs/default/plugins/plot_options/plot_options.vue b/jdaviz/configs/default/plugins/plot_options/plot_options.vue index aefe22a8f4..d3dfe24b3f 100644 --- a/jdaviz/configs/default/plugins/plot_options/plot_options.vue +++ b/jdaviz/configs/default/plugins/plot_options/plot_options.vue @@ -66,11 +66,11 @@ mdi-eye{{ marker_visible_value ? '' : '-off' }} - Show Marker + Show Scatter Layer - + mdi-eye{{ line_visible_value ? '' : '-off' }} @@ -108,7 +108,16 @@ - Line + Line + + + + mdi-eye{{ line_visible_value ? '' : '-off' }} + + Show Line + + + - +
Line Color @@ -139,25 +148,25 @@
- + - +
Line Opacity
- + - + -
+
Marker