Skip to content

Commit

Permalink
Reverse preset color order
Browse files Browse the repository at this point in the history
Add changelog
  • Loading branch information
rosteen committed Nov 14, 2023
1 parent cfe7e25 commit 103acaa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ New Features

- Reorder viewer and layer settings in Plot Options. [#2543, #2557]

- Add button in Plot Options to apply preset RBG options to visible layers when in Monochromatic mode. [#2558]
- Add button in Plot Options to apply preset RBG options to visible layers when in Monochromatic mode. [#2558, #2568]

Cubeviz
^^^^^^^
Expand Down
12 changes: 6 additions & 6 deletions jdaviz/configs/default/plugins/plot_options/plot_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,11 +616,11 @@ def apply_RGB_presets(self):
self.image_color_mode_sync['mixed']):
raise ValueError("RGB presets can only be applied if color mode is Monochromatic.")
# Preselected colors we want to use for 5 or less layers
preset_colors = [self.swatches_palette[0][0],
self.swatches_palette[1][0],
"#00FF00",
preset_colors = [self.swatches_palette[4][1],
"#0000FF",
self.swatches_palette[4][1]
"#00FF00",
self.swatches_palette[1][0],
self.swatches_palette[0][0],
]

# Switch back to this at the end
Expand All @@ -641,9 +641,9 @@ def apply_RGB_presets(self):
default_opacity = 1 / math.log2(n_visible)
# Sample along a colormap if we have too many layers
if n_visible == 2:
preset_colors = [preset_colors[0], preset_colors[3]]
preset_colors = [preset_colors[1], preset_colors[4]]

Check warning on line 644 in jdaviz/configs/default/plugins/plot_options/plot_options.py

View check run for this annotation

Codecov / codecov/patch

jdaviz/configs/default/plugins/plot_options/plot_options.py#L644

Added line #L644 was not covered by tests
elif n_visible == 3:
preset_colors = [preset_colors[0], preset_colors[2], preset_colors[3]]
preset_colors = [preset_colors[1], preset_colors[2], preset_colors[4]]

Check warning on line 646 in jdaviz/configs/default/plugins/plot_options/plot_options.py

View check run for this annotation

Codecov / codecov/patch

jdaviz/configs/default/plugins/plot_options/plot_options.py#L646

Added line #L646 was not covered by tests
elif n_visible > len(preset_colors):
cmap = matplotlib.colormaps['gist_rainbow'].resampled(n_visible)
preset_colors = [matplotlib.colors.to_hex(cmap(i), keep_alpha=True) for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ def test_apply_presets(imviz_helper):
arr = np.arange(36).reshape(6, 6)
po = imviz_helper.plugins['Plot Options']

preset_colors = [po._obj.swatches_palette[0][0], po._obj.swatches_palette[1][0],
"#00FF00", "#0000FF", po._obj.swatches_palette[4][1]]
preset_colors = [po._obj.swatches_palette[4][1], "#0000FF", "#00FF00",
po._obj.swatches_palette[1][0], po._obj.swatches_palette[0][0],]

# Test applying presets with < 6 layers

Expand Down

0 comments on commit 103acaa

Please sign in to comment.