Skip to content

Commit

Permalink
Change default color for plugin lines and scatter marks to increase v…
Browse files Browse the repository at this point in the history
…isibility (#2453)

* change default PluginLine and PluginScatter color to jdaviz accent
orange, remove orange from color cycler

* changelog, removing duplicate default glue gray definition
  • Loading branch information
bmorris3 authored Sep 15, 2023
1 parent 639d22e commit 70ad90a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ New Features

- Subset Tools plugin now displays the parent data of a spatial (ROI) subset. [#2154]

- Data color cycler and marker color updates for increased accessibility. [#2453]

Cubeviz
^^^^^^^

Expand Down
11 changes: 7 additions & 4 deletions jdaviz/core/marks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
'LineAnalysisContinuumLeft', 'LineAnalysisContinuumRight',
'LineUncertainties', 'ScatterMask', 'SelectedSpaxel', 'MarkersMark', 'FootprintOverlay']

accent_color = "#c75d2c"


class OffscreenLinesMarks(HubListener):
def __init__(self, viewer):
Expand Down Expand Up @@ -578,15 +580,16 @@ class PluginLine(Lines, PluginMark, HubListener):
def __init__(self, viewer, x=[], y=[], **kwargs):
self.viewer = viewer
# color is same blue as import button
kwargs.setdefault('colors', ["#007BA1"])
kwargs.setdefault('colors', [accent_color])
super().__init__(x=x, y=y, scales=viewer.scales, **kwargs)


class PluginScatter(Scatter, PluginMark, HubListener):
def __init__(self, viewer, x=[], y=[], **kwargs):
self.viewer = viewer
# color is same blue as import button
super().__init__(x=x, y=y, colors=["#007BA1"], scales=viewer.scales, **kwargs)
# default color is same blue as import button
kwargs.setdefault('colors', [accent_color])
super().__init__(x=x, y=y, scales=viewer.scales, **kwargs)


class LineAnalysisContinuum(PluginLine):
Expand Down Expand Up @@ -653,7 +656,7 @@ class HistogramMark(Lines):
def __init__(self, min_max_value, scales, **kwargs):
# Vertical line in LinearScale
y = [0, 1]
colors = ["#c75d2c"]
colors = [accent_color]
line_style = "solid"
super().__init__(x=min_max_value, y=y, scales=scales, colors=colors, line_style=line_style,
**kwargs)
20 changes: 15 additions & 5 deletions jdaviz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import threading
from collections import deque

import matplotlib.pyplot as plt
from astropy.io import fits
from astropy.utils import minversion
from ipyvue import watch
Expand Down Expand Up @@ -246,11 +245,22 @@ class ColorCycler:
using the Glue default data color.
"""
# default color cycle starts with the Glue default data color
# followed by the matplotlib default color cycle
# followed by the matplotlib default color cycle, except for the
# second color (orange) in the matplotlib cycle, which is too close
# to the jdaviz accent color (also orange).
default_dark_gray = settings._defaults['DATA_COLOR']
default_color_palette = (
[default_dark_gray] + plt.rcParams['axes.prop_cycle'].by_key()['color']
)
default_color_palette = [
default_dark_gray,
'#1f77b4',
'#2ca02c',
'#d62728',
'#9467bd',
'#8c564b',
'#e377c2',
'#7f7f7f',
'#bcbd22',
'#17becf'
]

def __init__(self, counter=-1):
self.counter = counter
Expand Down

0 comments on commit 70ad90a

Please sign in to comment.