Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default color for plugin lines and scatter marks to increase visibility #2453

Merged
merged 2 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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