Skip to content

Commit 07ba7a2

Browse files
zlmarshallZach MarshallZach Marshallpre-commit-ci[bot]andrzejnovak
authored
feat!: updating ATLAS color palette to match collboration recommendations (#574)
* Updating ATLAS color palette After an internal working group to discuss color palette options and color-vision deficiency of various kinds, these are the proposed colors that the experiment will adopt. * Attempting updates following review Giving a few things a try here: - Breaking out ATLAS style into ATLAS1 and ATLAS2 - Copying styles around a bit - Keeping the old (disfavored) color scheme - Linking to documentation for ATLAS members - Updating the mplhep documentation itself I hope I got all this right, but further comment is always welcome. * Adding quotes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Imports * Updating documentation and colors again in advance of the presentation It appears that the working group has re-converged, but there will be an additional discussion this week on the palettes, and probably we should resist the temptation to merge this until then. Review is of course welcome nevertheless. * An additional style without the read * Updating ATLAS color palettes with final recommendations We believe these are now the final recommendations of the collaboration. * Spelling mistake * Spelling mistake * Adding ATLAS1 and ATLAS2 explicitly to the styles to be built for the gallery * Adding links to documentation * Another place where the styles need to be listed... --------- Co-authored-by: Zach Marshall <[email protected]> Co-authored-by: Zach Marshall <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Andrzej Novak <[email protected]>
1 parent 802024a commit 07ba7a2

File tree

4 files changed

+55
-18
lines changed

4 files changed

+55
-18
lines changed

docs/source/gallery/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Gallery
3232
# and s != "LHCb" # we want LHCb1 or LHCb2
3333
# ]
3434
# the upper one contains all possible styles, needed?
35-
allstyle = ["ATLAS", "ATLASAlt", "CMS", "LHCb1", "LHCb2", "ALICE"]
35+
allstyle = ["ATLAS1", "ATLAS2", "CMS", "LHCb1", "LHCb2", "ALICE"]
3636
allstyle = sorted(allstyle, key=lambda s: s.lower())
3737
# allstyle = sorted(allstyle, key=lambda s: s.lower().endswith("tex"))
3838
allstyle = sorted(allstyle, key=lambda s: s.lower().endswith("alt"))

docs/source/gallery/styles.rst

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,34 @@ to illustrate the visual appearance of the styles.
2727
ATLAS
2828
------------
2929

30-
ATLAS has two styles, the default one and the alternative one.
30+
ATLAS has two `recommended styles <https://twiki.cern.ch/twiki/bin/view/AtlasProtected/PubComPlotStyle#Color_vision_deficiency_palette>`__.
31+
The main recommendation, ``ATLAS`` (or ``ATLAS2``, based on `this work <https://jfly.uni-koeln.de/color/>`__) provides 7 colors,
32+
with Vermilion, the first color in the palette, recommended for signal. In the case of large signals, white can also be used.
3133

32-
33-
.. image:: ../../_static/_generated/ATLAS/fill/pos0.png
34+
.. image:: ../../_static/_generated/ATLAS2/fill/pos0.png
3435
:width: 45%
3536

36-
.. image:: ../../_static/_generated/ATLAS/step/pos0.png
37+
.. image:: ../../_static/_generated/ATLAS2/step/pos0.png
3738
:width: 45%
3839

39-
.. image:: ../../_static/_generated/ATLAS/errorbar/pos0.png
40+
.. image:: ../../_static/_generated/ATLAS2/errorbar/pos0.png
4041
:width: 45%
4142

42-
.. image:: ../../_static/_generated/ATLAS/band/pos0.png
43+
.. image:: ../../_static/_generated/ATLAS2/band/pos0.png
4344
:width: 45%
4445

45-
ATLAS alternative, named ``ATLASAlt``
46+
For plots that require large numbers of colors, the ``ATLAS1`` palette is provided with 10 colors `based on this paper <https://arxiv.org/pdf/2107.02270>`__.
4647

47-
.. image:: ../../_static/_generated/ATLASAlt/fill/pos0.png
48+
.. image:: ../../_static/_generated/ATLAS1/fill/pos0.png
4849
:width: 45%
4950

50-
.. image:: ../../_static/_generated/ATLASAlt/step/pos0.png
51+
.. image:: ../../_static/_generated/ATLAS1/step/pos0.png
5152
:width: 45%
5253

53-
.. image:: ../../_static/_generated/ATLASAlt/errorbar/pos0.png
54+
.. image:: ../../_static/_generated/ATLAS1/errorbar/pos0.png
5455
:width: 45%
5556

56-
.. image:: ../../_static/_generated/ATLASAlt/band/pos0.png
57+
.. image:: ../../_static/_generated/ATLAS1/band/pos0.png
5758
:width: 45%
5859

5960
CMS

src/mplhep/styles/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# Short cut to all styles
1010
from .alice import ALICE
11-
from .atlas import ATLAS, ATLASAlt, ATLASTex
11+
from .atlas import ATLAS, ATLAS1, ATLAS2, ATLASAlt, ATLASTex
1212
from .cms import CMS, ROOT, CMSTex, ROOTTex
1313
from .lhcb import LHCb, LHCb1, LHCb2, LHCbTex, LHCbTex1, LHCbTex2
1414
from .plothist import PLOTHIST
@@ -19,6 +19,8 @@
1919
"CMS",
2020
"PLOTHIST",
2121
"ROOT",
22+
"ATLAS1",
23+
"ATLAS2",
2224
"ATLASAlt",
2325
"ATLASTex",
2426
"CMSTex",

src/mplhep/styles/atlas.py

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
from cycler import cycler
77

88
# Color wheel from https://arxiv.org/pdf/2107.02270 Table 1, 10 color palette
9-
color_sequence = [
9+
# This is the color wheel recommended for plots that require a large number
10+
# of colors that would not be satisfied by the below palette
11+
color_sequence1 = [
1012
"#3f90da",
1113
"#ffa90e",
1214
"#bd1f01",
@@ -19,6 +21,20 @@
1921
"#92dadd",
2022
]
2123

24+
# Color wheel based on internal discussions of optimal
25+
# colors for visibility, accounting for color vision deficiency
26+
# The recommendation for signal is the first color (Vermilion)
27+
# For large signals, ROOT.kWhite / '#ffffff' is also an option
28+
color_sequence2 = [
29+
"#d55e00",
30+
"#56b4e9",
31+
"#e69f00",
32+
"#f0e442",
33+
"#009e73",
34+
"#cc79a7",
35+
"#0072b2",
36+
]
37+
2238
_base = {
2339
# fonts and text
2440
# initially from https://github.com/kratsg/ATLASstylempl
@@ -49,7 +65,6 @@
4965
"figure.subplot.left": 0.16,
5066
"figure.subplot.right": 0.95,
5167
# axes
52-
"axes.prop_cycle": cycler("color", color_sequence),
5368
"axes.titlesize": "xx-large",
5469
"axes.labelsize": "x-large",
5570
"axes.linewidth": 1,
@@ -106,8 +121,22 @@
106121
"savefig.transparent": False,
107122
}
108123

109-
ATLAS: dict[str, Any] = {
124+
ATLAS1: dict[str, Any] = {
110125
**_base,
126+
"axes.prop_cycle": cycler("color", color_sequence1),
127+
"mathtext.fontset": "custom",
128+
"mathtext.rm": "TeX Gyre Heros",
129+
"mathtext.bf": "TeX Gyre Heros:bold",
130+
"mathtext.sf": "TeX Gyre Heros",
131+
"mathtext.it": "TeX Gyre Heros:italic",
132+
"mathtext.tt": "TeX Gyre Heros",
133+
"mathtext.cal": "TeX Gyre Heros",
134+
"mathtext.default": "it",
135+
}
136+
137+
ATLAS2: dict[str, Any] = {
138+
**_base,
139+
"axes.prop_cycle": cycler("color", color_sequence2),
111140
"mathtext.fontset": "custom",
112141
"mathtext.rm": "TeX Gyre Heros",
113142
"mathtext.bf": "TeX Gyre Heros:bold",
@@ -121,12 +150,13 @@
121150
# use dejavusans (default math fontset)
122151
ATLASAlt: dict[str, Any] = {
123152
**_base,
153+
"axes.prop_cycle": cycler("color", color_sequence1),
124154
"mathtext.default": "it",
125155
}
126156

127157
# use LaTeX
128158
ATLASTex: dict[str, Any] = {
129-
**_base,
159+
**ATLAS2,
130160
"text.usetex": True,
131161
"text.latex.preamble": "\n".join(
132162
[
@@ -144,6 +174,10 @@
144174
}
145175

146176
# Filter extra (labellocation) items if needed
147-
ATLAS = {k: v for k, v in ATLAS.items() if k in mpl.rcParams}
177+
ATLAS1 = {k: v for k, v in ATLAS1.items() if k in mpl.rcParams}
178+
ATLAS2 = {k: v for k, v in ATLAS2.items() if k in mpl.rcParams}
148179
ATLASAlt = {k: v for k, v in ATLASAlt.items() if k in mpl.rcParams}
149180
ATLASTex = {k: v for k, v in ATLASTex.items() if k in mpl.rcParams}
181+
182+
# Alias 'ATLAS' to the one that most folks should use
183+
ATLAS = ATLAS2.copy()

0 commit comments

Comments
 (0)