From 9f52981756d7294628494795e9aa03cc8a152c1b Mon Sep 17 00:00:00 2001 From: AsaNehm <101250148+AsaNehm@users.noreply.github.com> Date: Tue, 7 Oct 2025 12:04:37 +0200 Subject: [PATCH 1/6] Off-white background implementation (matplotlib) To allow for seamless plots on the updated DUNE slides template, this adds the option to change the background color of plots to the same off-white (#f0f0f0) color. Function is called off_white.bkg and would be called like the other dunestyle functions --- src/matplotlib/python/dunestyle.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/matplotlib/python/dunestyle.py b/src/matplotlib/python/dunestyle.py index 9d95661..e99c8ea 100644 --- a/src/matplotlib/python/dunestyle.py +++ b/src/matplotlib/python/dunestyle.py @@ -146,3 +146,10 @@ def SetOkabeItoColors(): from cycler import cycler cyc = cycler(color=['#000000', '#D55E00', '#56B4E9', '#E69F00', '#009E73', '#CC79A7', '#0072B2', '#F0E442',]) plt.rc("axes", prop_cycle=cyc) + +def off_white_bkg(): + """ Set the background color of the figure to match the off-white background of the updated DUNE slide template. """ + + plt.rcParams['axes.facecolor'] = '#f0f0f0' + plt.rcParams['figure.facecolor'] = '#f0f0f0' + plt.rcParams['savefig.facecolor'] = '#f0f0f0' From 9d79ca8ac5aa837b6ccd31cf37ebe5dd50179df7 Mon Sep 17 00:00:00 2001 From: AsaNehm <101250148+AsaNehm@users.noreply.github.com> Date: Tue, 7 Oct 2025 12:14:15 +0200 Subject: [PATCH 2/6] Update dune.mplstyle --- src/matplotlib/stylelib/dune.mplstyle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/matplotlib/stylelib/dune.mplstyle b/src/matplotlib/stylelib/dune.mplstyle index 49a406c..76b4c5e 100644 --- a/src/matplotlib/stylelib/dune.mplstyle +++ b/src/matplotlib/stylelib/dune.mplstyle @@ -13,9 +13,9 @@ text.hinting_factor : 8 #mathtext.fontset : cm -figure.facecolor: white +figure.facecolor: white (default, can be changed with off_white_bkg to #f0f0f0 for slides) -axes.facecolor: white # eeeeee +axes.facecolor: white # eeeeee (default, can be changed with off_white_bkg to #f0f0f0 for slides) axes.edgecolor: black axes.grid : False axes.linewidth: 1.0 From 37ac79a981406fdb9ec4f37534fa18a9bd79789b Mon Sep 17 00:00:00 2001 From: Jeremy Wolcott Date: Tue, 7 Oct 2025 12:39:42 +0200 Subject: [PATCH 3/6] add corresponding ROOT function --- src/root/cpp/include/DUNEStyle.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/root/cpp/include/DUNEStyle.h b/src/root/cpp/include/DUNEStyle.h index 430afa9..0354540 100644 --- a/src/root/cpp/include/DUNEStyle.h +++ b/src/root/cpp/include/DUNEStyle.h @@ -90,6 +90,12 @@ namespace dunestyle throw std::out_of_range("Unknown OIColor"); } } + + const TColor & GetOffWhiteColor() + { + static const TColor __kOffWhite(TColor::GetFreeColorIndex(), 0.9412, 0.9412, 0.9412); + return __kOffWhite; + } } // ---------------------------------------------------------------------------- @@ -122,6 +128,9 @@ namespace dunestyle inline Color_t kOkabeItoRedPurple = _internal::GetOIColor(_internal::OIColors::kRedPurple).GetNumber(); ///@} + /// Off-white color, used to improve access for those with dyslexia + inline Color_t kOffWhite = _internal::GetOffWhiteColor().GetNumber(); + /// If you would like all the colors in one package const std::map> kColorCycles { @@ -332,6 +341,16 @@ namespace dunestyle gStyle->SetPalette(n_color_contours, colors); } + // ---------------------------------------------------------------------------- + void OffWhiteBackground() + { + duneStyle->SetFillColor(colors::kOffWhite); + duneStyle->SetFrameFillColor(colors::kOffWhite); + duneStyle->SetCanvasColor(colors::kOffWhite); + duneStyle->SetPadColor(colors::kOffWhite); + duneStyle->SetStatColor(colors::kOffWhite); + } + // ---------------------------------------------------------------------------- /// Divide a TCanvas into two pads. @@ -440,7 +459,8 @@ namespace dunestyle // No info box duneStyle->SetOptStat(0); - //set the background color to white + //set the background color to white. + // see OffWhiteBackground() above for an alternative... duneStyle->SetFillColor(10); duneStyle->SetFrameFillColor(10); duneStyle->SetCanvasColor(10); From cbc9bb2bbda1c0143fc5d4a9476ad5db69ed9877 Mon Sep 17 00:00:00 2001 From: Jeremy Wolcott Date: Tue, 7 Oct 2025 12:43:32 +0200 Subject: [PATCH 4/6] whoops, use whatever style is currently enabled --- src/root/cpp/include/DUNEStyle.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/root/cpp/include/DUNEStyle.h b/src/root/cpp/include/DUNEStyle.h index 0354540..2c71333 100644 --- a/src/root/cpp/include/DUNEStyle.h +++ b/src/root/cpp/include/DUNEStyle.h @@ -344,12 +344,11 @@ namespace dunestyle // ---------------------------------------------------------------------------- void OffWhiteBackground() { - duneStyle->SetFillColor(colors::kOffWhite); - duneStyle->SetFrameFillColor(colors::kOffWhite); - duneStyle->SetCanvasColor(colors::kOffWhite); - duneStyle->SetPadColor(colors::kOffWhite); - duneStyle->SetStatColor(colors::kOffWhite); - } + gStyle->SetFillColor(colors::kOffWhite); + gStyle->SetFrameFillColor(colors::kOffWhite); + gStyle->SetCanvasColor(colors::kOffWhite); + gStyle->SetPadColor(colors::kOffWhite); + gStyle->SetStatColor(colors::kOffWhite);g // ---------------------------------------------------------------------------- From d1d11970cc8b85eb0ff515edbaaf443a69ac0258 Mon Sep 17 00:00:00 2001 From: Jeremy Wolcott Date: Tue, 7 Oct 2025 12:47:25 +0200 Subject: [PATCH 5/6] urgh, misplaced character --- src/root/cpp/include/DUNEStyle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/root/cpp/include/DUNEStyle.h b/src/root/cpp/include/DUNEStyle.h index 2c71333..7f26dd7 100644 --- a/src/root/cpp/include/DUNEStyle.h +++ b/src/root/cpp/include/DUNEStyle.h @@ -348,7 +348,7 @@ namespace dunestyle gStyle->SetFrameFillColor(colors::kOffWhite); gStyle->SetCanvasColor(colors::kOffWhite); gStyle->SetPadColor(colors::kOffWhite); - gStyle->SetStatColor(colors::kOffWhite);g + gStyle->SetStatColor(colors::kOffWhite); // ---------------------------------------------------------------------------- From 29cc60f8f8cb42f16662fd20d0fc69827c7c6ca7 Mon Sep 17 00:00:00 2001 From: Jeremy Wolcott Date: Tue, 7 Oct 2025 12:55:46 +0200 Subject: [PATCH 6/6] also fill in the title's bkgd --- src/root/cpp/include/DUNEStyle.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/root/cpp/include/DUNEStyle.h b/src/root/cpp/include/DUNEStyle.h index 7f26dd7..8aa69c6 100644 --- a/src/root/cpp/include/DUNEStyle.h +++ b/src/root/cpp/include/DUNEStyle.h @@ -347,8 +347,10 @@ namespace dunestyle gStyle->SetFillColor(colors::kOffWhite); gStyle->SetFrameFillColor(colors::kOffWhite); gStyle->SetCanvasColor(colors::kOffWhite); + gStyle->SetTitleFillColor(colors::kOffWhite); gStyle->SetPadColor(colors::kOffWhite); gStyle->SetStatColor(colors::kOffWhite); + } // ----------------------------------------------------------------------------