Skip to content

Commit

Permalink
expose spatial subset opacity in plot options
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Jan 17, 2024
1 parent 8456914 commit d9c5ba7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ New Features

- Spectrum viewer bounds can now be set through the Plot Options UI. [#2604]

- Opacity for spatial subsets is now adjustable from within Plot Options. [#2663]

Cubeviz
^^^^^^^
- Calculated moments can now be output in velocity units. [#2584, #2588]
Expand Down
10 changes: 9 additions & 1 deletion jdaviz/configs/default/plugins/plot_options/plot_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ class PlotOptions(PluginTemplateMixin):
whether a subset should be visible.
* ``subset_color`` (:class:`~jdaviz.core.template_mixin.PlotOptionsSyncState`):
not exposed for Specviz
* ``subset_opacity`` (:class:`~jdaviz.core.template_mixin.PlotOptionsSyncState`):
not exposed for Specviz
* ``axes_visible`` (:class:`~jdaviz.core.template_mixin.PlotOptionsSyncState`):
not exposed for Imviz
* ``collapse_function`` (:class:`~jdaviz.core.template_mixin.PlotOptionsSyncState`):
Expand Down Expand Up @@ -303,6 +305,9 @@ class PlotOptions(PluginTemplateMixin):
subset_color_value = Unicode().tag(sync=True)
subset_color_sync = Dict().tag(sync=True)

subset_opacity_value = Float().tag(sync=True)
subset_opacity_sync = Dict().tag(sync=True)

image_visible_value = Bool().tag(sync=True)
image_visible_sync = Dict().tag(sync=True)

Expand Down Expand Up @@ -561,6 +566,9 @@ def state_attr_for_line_visible(state):
self.subset_color = PlotOptionsSyncState(self, self.viewer, self.layer, 'color',
'subset_color_value', 'subset_color_sync',
state_filter=is_spatial_subset)
self.subset_opacity = PlotOptionsSyncState(self, self.viewer, self.layer, 'alpha',
'subset_opacity_value', 'subset_opacity_sync',
state_filter=is_spatial_subset)
self.image_visible = PlotOptionsSyncState(self, self.viewer, self.layer, 'bitmap_visible',
'image_visible_value', 'image_visible_sync',
state_filter=is_image)
Expand Down Expand Up @@ -624,7 +632,7 @@ def user_api(self):
expose += ['axes_visible', 'line_visible', 'line_color', 'line_width', 'line_opacity',
'line_as_steps', 'uncertainty_visible']
if self.config != "specviz":
expose += ['subset_color',
expose += ['subset_color', 'subset_opacity',
'stretch_function', 'stretch_preset', 'stretch_vmin', 'stretch_vmax',
'stretch_hist_zoom_limits', 'stretch_hist_nbins',
'image_visible', 'image_color_mode',
Expand Down
7 changes: 7 additions & 0 deletions jdaviz/configs/default/plugins/plot_options/plot_options.vue
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@
</div>
</glue-state-sync-wrapper>

<glue-state-sync-wrapper :sync="subset_opacity_sync" :multiselect="layer_multiselect" @unmix-state="unmix_state('subset_opacity')">
<div>
<v-subheader class="pl-0 slider-label" style="height: 12px">Subset Opacity</v-subheader>
<glue-throttled-slider wait="300" max="1" step="0.01" :value.sync="subset_opacity_value" hide-details class="no-hint" />
</div>
</glue-state-sync-wrapper>


<!-- PROFILE/LINE -->
<j-plugin-section-header v-if="(line_visible_sync.in_subscribed_states && ((!marker_visible_sync.in_subscribed_states && line_visible_value) || (marker_visible_sync.in_subscribed_states && marker_visible_value))) || collapse_func_sync.in_subscribed_states">Line</j-plugin-section-header>
Expand Down

0 comments on commit d9c5ba7

Please # to comment.