White overlay with TMultiGraph

ROOT Version: 6.28/04
Platform: WSL 1, Ubuntu 20.04
Compiler: gcc 9.4.0


I am facing problems with visualizing ~40 TGraphs on the same canvas. The following script
superimpose_EOS_massive.py (1.6 KB)
reads same structure TGraph from multiple rootfiles, which I intended to superimpose. Sample rootfile follows
cooling_curve_mass_1.48.root (63.0 KB).
To a sad surprise, the result looks very eye-cutting
cooling_curves_many.pdf (318.1 KB)
, which appears to me that multiple graph overlays are replaced with white. I could not find a good workaround, which included messing with linestyles, linesizes, canvas sizes etc. It is, of course, essential to receive pdf as the end product.

Could you please suggest?
Thank you.

Don’t do cooling_curve.SetLineColor(i) if i goes from 0 to a high value. See the corresponding colours here:
Some alternatives:

  • define an array with the numbers of the colours you want to use from the basic colours above
  • define an array with the colours from the “color wheel” (same page as above), for more options
  • create your own table of colours with CreateGradientColorTable and use these; you can read about it on the same TColor page, and here:
    ROOT: tutorials/graphs/multipalette.C File Reference
    Note in particular these lines
      Int_t FI = TColor::CreateGradientColorTable(3,Length,Red,Green,Blue,50);
      for (int i=0; i<50; i++) colors[i] = FI+i;

For pyroot, see for example

Thank you for your commentary, that is some useful stuff on TColor. I did not expect many colours to be used (as mentioned, only 40 TGraphs), yet you pointed me on the clue. I iterated over the same TGraphs for 1400 times by accident, that is why I ran so well out of palette.

Appreciate your help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.