Skip to content

Commit

Permalink
only include stretch tool in stretch histogram (#2556)
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry authored Nov 8, 2023
1 parent e8a03f9 commit 3d461b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ New Features
- Plots in plugins now include basic zoom/pan tools for Plot Options,
Imviz Line Profiles, and Imviz's aperture photometry. [#2498]

- Histogram plot in Plot Options now includes tool to set stretch vmin and vmax. [#2513]
- Histogram plot in Plot Options now includes tool to set stretch vmin and vmax. [#2513, #2556]

- The Plot Options plugin now include a 'spline' stretch feature. [#2525]

Expand Down
5 changes: 1 addition & 4 deletions jdaviz/configs/default/plugins/plot_options/plot_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from glue_jupyter.bqplot.image.state import BqplotImageLayerState
from glue_jupyter.common.toolbar_vuetify import read_icon

from jdaviz.components.toolbar_nested import NestedJupyterToolbar
from jdaviz.core.registries import tray_registry
from jdaviz.core.template_mixin import (PluginTemplateMixin, ViewerSelect, LayerSelect,
PlotOptionsSyncState, Plot,
Expand Down Expand Up @@ -465,9 +464,7 @@ def state_attr_for_line_visible(state):
self.stretch_histogram = Plot(self, viewer_type='histogram')
# Add the stretch bounds tool to the default Plot viewer.
self.stretch_histogram.tools_nested.append(["jdaviz:stretch_bounds"])
self.stretch_histogram.toolbar = NestedJupyterToolbar(self.stretch_histogram.viewer,
self.stretch_histogram.tools_nested,
["jdaviz:stretch_bounds"])
self.stretch_histogram._initialize_toolbar(["jdaviz:stretch_bounds"])

# NOTE: this is a current workaround so the histogram viewer doesn't crash when replacing
# data. Note also that passing x=[0] fails on SOME machines, so we'll pass [0, 1] instead
Expand Down
15 changes: 9 additions & 6 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3273,11 +3273,6 @@ class Plot(PluginSubcomponent):

figure = Any().tag(sync=True, **widget_serialization)
toolbar = Any().tag(sync=True, **widget_serialization)
tools_nested = [
['jdaviz:homezoom', 'jdaviz:prevzoom'],
['jdaviz:boxzoom', 'jdaviz:xrangezoom', 'jdaviz:yrangezoom'],
['jdaviz:panzoom', 'jdaviz:panzoom_x', 'jdaviz:panzoom_y'],
]

def __init__(self, plugin, viewer_type='scatter', app=None, *args, **kwargs):
super().__init__(plugin, 'Plot', *args, **kwargs)
Expand All @@ -3299,7 +3294,15 @@ def __init__(self, plugin, viewer_type='scatter', app=None, *args, **kwargs):
self.figure.title_style = {'font-size': '12px'}
self.figure.fig_margin = {'top': 60, 'bottom': 60, 'left': 60, 'right': 10}

self.toolbar = NestedJupyterToolbar(self.viewer, self.tools_nested, [])
self.tools_nested = [
['jdaviz:homezoom', 'jdaviz:prevzoom'],
['jdaviz:boxzoom', 'jdaviz:xrangezoom', 'jdaviz:yrangezoom'],
['jdaviz:panzoom', 'jdaviz:panzoom_x', 'jdaviz:panzoom_y'],
]
self._initialize_toolbar()

def _initialize_toolbar(self, default_tool_priority=[]):
self.toolbar = NestedJupyterToolbar(self.viewer, self.tools_nested, default_tool_priority)

@property
def app(self):
Expand Down

0 comments on commit 3d461b6

Please sign in to comment.