Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
accessiblecolorschemes.C File Reference

Detailed Description

View in nbviewer Open in SWAN
Choosing an appropriate color scheme is essential for making results easy to understand and interpret.

Factors like colorblindness and converting colors to grayscale for publications can impact accessibility. Furthermore, results should be aesthetically pleasing. The following three color schemes, recommended by M. Petroff in arXiv:2107.02270v2 and available on GitHub under the MIT License, meet these criteria.

void box(double x1, double y1, double x2, double y2,int col) {
auto b1 = new TBox(x1, y1, x2, y2);
b1->SetFillColor(col);
b1->Draw();
TColor *c = gROOT->GetColor(col);
auto tc = new TLatex((x2+x1)/2., 0.01+(y2+y1)/2., Form("#splitline{%s}{%s}",c->GetName(),c->GetTitle()));
tc->SetTextFont(42);
tc->SetTextAlign(23);
tc->SetTextSize(0.020);
tc->Draw();
}
void accessiblecolorschemes() {
auto C = new TCanvas("C","C",600,800);
int c;
double x, y;
double w = 0.2;
double h = 0.08;
auto t = new TText();
t->SetTextSize(0.025);
t->SetTextFont(42);
// 6-colors scheme
x = 0.1;
y = 0.1;
t->DrawText(x, y-h/2., "6-colors scheme");
for (c=kP6Blue; c<kP6Blue+6; c++) {
box(x, y, x+w, y+h,c);
y = y+h;
}
// 8-color scheme
y = 0.1;
x = 0.4;
t->DrawText(x, y-h/2., "8-colors scheme");
for (c=kP8Blue; c<kP8Blue+8; c++) {
box(x, y, x+w, y+h,c);
y = y+h;
}
// 10-color scheme
y = 0.1;
x = 0.7;
t->DrawText(x, y-h/2., "10-colors scheme");
for (c=kP10Blue; c<kP10Blue+10; c++) {
box(x, y, x+w, y+h,c);
y = y+h;
}
}
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
@ kP8Blue
Definition Rtypes.h:70
@ kP10Blue
Definition Rtypes.h:71
@ kP6Blue
Definition Rtypes.h:69
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
#define gROOT
Definition TROOT.h:406
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
Create a Box.
Definition TBox.h:22
The Canvas class.
Definition TCanvas.h:23
The color creation and management class.
Definition TColor.h:21
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1920
To draw Mathematical Formula.
Definition TLatex.h:18
Base class for several text objects.
Definition TText.h:22
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition fillpatterns.C:1
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Author
Olivier Couet

Definition in file accessiblecolorschemes.C.