From 552c2d95a87b60833680d3f16f1e404f5262d930 Mon Sep 17 00:00:00 2001 From: Jeremy Wolcott Date: Wed, 8 Oct 2025 10:55:28 +0200 Subject: [PATCH 1/4] fix typo --- src/matplotlib/stylelib/dune.mplstyle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matplotlib/stylelib/dune.mplstyle b/src/matplotlib/stylelib/dune.mplstyle index 76b4c5e..6697787 100644 --- a/src/matplotlib/stylelib/dune.mplstyle +++ b/src/matplotlib/stylelib/dune.mplstyle @@ -13,7 +13,7 @@ text.hinting_factor : 8 #mathtext.fontset : cm -figure.facecolor: white (default, can be changed with off_white_bkg to #f0f0f0 for slides) +figure.facecolor: white # (default, can be changed with off_white_bkg to #f0f0f0 for slides) axes.facecolor: white # eeeeee (default, can be changed with off_white_bkg to #f0f0f0 for slides) axes.edgecolor: black From 8542d9e2763fa27a21e529003ede7eb25a4e55a8 Mon Sep 17 00:00:00 2001 From: Jeremy Wolcott Date: Wed, 8 Oct 2025 10:56:19 +0200 Subject: [PATCH 2/4] change method name to match convention in this file --- src/matplotlib/python/dunestyle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matplotlib/python/dunestyle.py b/src/matplotlib/python/dunestyle.py index e99c8ea..eadd4cc 100644 --- a/src/matplotlib/python/dunestyle.py +++ b/src/matplotlib/python/dunestyle.py @@ -147,7 +147,7 @@ def SetOkabeItoColors(): cyc = cycler(color=['#000000', '#D55E00', '#56B4E9', '#E69F00', '#009E73', '#CC79A7', '#0072B2', '#F0E442',]) plt.rc("axes", prop_cycle=cyc) -def off_white_bkg(): +def OffWhiteBackground(): """ Set the background color of the figure to match the off-white background of the updated DUNE slide template. """ plt.rcParams['axes.facecolor'] = '#f0f0f0' From 87c4f10709fbc8584003f5a24474b43be9cb6f8b Mon Sep 17 00:00:00 2001 From: Jeremy Wolcott Date: Wed, 8 Oct 2025 10:56:33 +0200 Subject: [PATCH 3/4] use off-white bkgd in examples --- examples/matplotlib/example.py | 6 ++++-- examples/root/cpp/example.C | 1 + examples/root/python/example.py | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/matplotlib/example.py b/examples/matplotlib/example.py index bde6a2b..96228e9 100644 --- a/examples/matplotlib/example.py +++ b/examples/matplotlib/example.py @@ -22,6 +22,8 @@ # how many histograms to draw in multi-hist plots N_HISTS = 8 # exhibits all the colors in the Okabe-Ito cycler +dunestyle.OffWhiteBackground() + ### 1D histogram example ### def Hist1D(pdf): x = np.random.normal(0, 1, 1000) @@ -103,7 +105,7 @@ def DataMC(pdf): transform=axs[0].transAxes) fontdict = {"size": 14} - axs[0].text(0.68, 0.52, 'A = {0:0.2f}$\pm${1:0.2f}'.format(A, dA), + axs[0].text(0.68, 0.52, r'A = {0:0.2f}$\pm${1:0.2f}'.format(A, dA), fontdict=fontdict, transform=axs[0].transAxes) axs[0].text(0.68, 0.46, r'$\mu$ = {0:0.2f}$\pm${1:0.2f}'.format(x0, dx0), @@ -112,7 +114,7 @@ def DataMC(pdf): axs[0].text(0.68, 0.40, r'$\sigma$ = {0:0.2f}$\pm${1:0.2f}'.format(sig, dsig), fontdict=fontdict, transform=axs[0].transAxes) - axs[0].text(0.68, 0.34, '$\chi^2$/ndof = {0:0.2f}/{1:d}'.format(chi2, ndf), + axs[0].text(0.68, 0.34, r'$\chi^2$/ndof = {0:0.2f}/{1:d}'.format(chi2, ndf), fontdict=fontdict, transform=axs[0].transAxes) axs[0].legend(fontsize="xx-large") # since the upper panel is only 70% of the whole canvas, the legend is (by default) too small diff --git a/examples/root/cpp/example.C b/examples/root/cpp/example.C index c93e024..e6a2aed 100644 --- a/examples/root/cpp/example.C +++ b/examples/root/cpp/example.C @@ -225,6 +225,7 @@ void OverlayExample(TCanvas * c, std::vector& hists) //------------------------------------------------------------------- void example() { + dunestyle::OffWhiteBackground(); TCanvas c; diff --git a/examples/root/python/example.py b/examples/root/python/example.py index ea600a6..59cf85f 100644 --- a/examples/root/python/example.py +++ b/examples/root/python/example.py @@ -204,6 +204,8 @@ def OverlayExample(c, hists): #------------------------------------------------------------------- #------------------------------------------------------------------- if __name__ == "__main__": + dunestyle.OffWhiteBackground() + c = ROOT.TCanvas() OneDHistExample(c) c.SaveAs("example.pyroot.pdf(") From 34d4e4fabc49518646bf8538912dff63eda0a5f5 Mon Sep 17 00:00:00 2001 From: Jeremy Wolcott Date: Wed, 8 Oct 2025 11:32:25 +0200 Subject: [PATCH 4/4] recommendation to use off-white background --- guidelines.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/guidelines.md b/guidelines.md index 0363511..a1eb89a 100644 --- a/guidelines.md +++ b/guidelines.md @@ -79,9 +79,18 @@ All plots **must**: - Check journal style guidelines carefully. - Ensure plot text size is similar to that in the body of the article as possible. -### Colo(u)r palette: +### Colo(u)r considerations: Color choices should look appealing and be accessible to those with color-vision deficiency (CVD). +#### Plot backgrounds: + +The high contrast resulting from fully saturated colors against a white background can be difficult for individuals with dyslexia. +Consider using an "off-white" background instead. +The functions `OffWhiteBackground()` in both ROOT and matplotlib toolkits in this package will set figure backgrounds +to match the off-white background in the [official DUNE slide template](https://docs.dunescience.org/cgi-bin/ShowDocument?docid=78). + +#### Markers/lines: + - When discrete curves are shown, the [Okabe-Ito color cycle](https://jfly.uni-koeln.de/color/) is recommended. (`dune_plot_style` sets the default matplotlib cycler to Okabe-Ito; the `dunestyle::colors::NextColor()` function can be used to obtain this cycle in ROOT.)