Hugonweb | Nice ROOT Style

/*
 *  justinStyle.C
 *  Ripped off of Joe Gartner on 10/25/2010
 */
#include "TStyle.h"

void jStyle() {
  TStyle *j = new TStyle("j","Basic Style");
  gROOT->ForceStyle();

  j->SetFillColor(kWhite);
  j->SetLegendBorderSize(0);
  j->SetLineWidth(2);
// For the canvas:
  j->SetCanvasBorderMode(0);
  j->SetCanvasColor(kWhite);
  j->SetCanvasDefH(600); //Height of canvas
  j->SetCanvasDefW(600); //Width of canvas
  j->SetCanvasDefX(0);   //POsition on screen
  j->SetCanvasDefY(0);

// For the Pad:
  j->SetPadBorderMode(0);
  // j->SetPadBorderSize(Width_t size = 1);
  j->SetPadColor(kWhite);
  j->SetPadGridX(false);
  j->SetPadGridY(false);
  j->SetGridColor(0);
  j->SetGridStyle(3);
  //j->SetGridWidth(1);

// For the frame:
  j->SetFrameBorderMode(0);
  j->SetFrameBorderSize(1);
  j->SetFrameFillColor(0);
  j->SetFrameFillStyle(0);
  j->SetFrameLineColor(1);
  j->SetFrameLineStyle(1);
  j->SetFrameLineWidth(2);

// For the histo:
  // j->SetHistFillColor(1);
  // j->SetHistFillStyle(0);
  //j->SetHistLineColor(1);
  //j->SetHistLineStyle(0);
  j->SetHistLineWidth(2);
  // j->SetLegoInnerR(Float_t rad = 0.5);
  // j->SetNumberContours(Int_t number = 20);

  j->SetEndErrorSize(2);
  //  j->SetErrorMarker(20);
  j->SetErrorX(0.);

  j->SetMarkerStyle(20);
  j->SetMarkerSize(1);

//For the fit/function:
  j->SetOptFit(1);
  j->SetFitFormat("5.4g");
  j->SetFuncColor(2);
  j->SetFuncStyle(1);
  j->SetFuncWidth(1);

//For the date:
  j->SetOptDate(0);
  // j->SetDateX(Float_t x = 0.01);
  // j->SetDateY(Float_t y = 0.01);

// For the statistics box:
  j->SetOptFile(0);
  j->SetOptStat(0); // To display the mean and RMS:   SetOptStat("mr");
  j->SetStatColor(kWhite);
  j->SetStatFont(42);
  j->SetStatFontSize(0.025);
  j->SetStatTextColor(1);
  j->SetStatFormat("6.4g");
  j->SetStatBorderSize(1);
  j->SetStatH(0.1);
  j->SetStatW(0.15);
  // j->SetStatStyle(Style_t style = 1001);
  // j->SetStatX(Float_t x = 0);
  // j->SetStatY(Float_t y = 0);

// Margins:
/*
  j->SetPadTopMargin(0.05);
  j->SetPadBottomMargin(0.13);
  j->SetPadLeftMargin(0.16);
  j->SetPadRightMargin(0.02);
*/

// For the Global title:

  j->SetOptTitle(1);
  j->SetTitleFont(42);
  j->SetTitleColor(1);
  j->SetTitleTextColor(1);
  j->SetTitleFillColor(10);
  j->SetTitleFontSize(0.05);
  j->SetTitleBorderSize(0);
  // j->SetTitleH(0); // Set the height of the title box
  // j->SetTitleW(0); // Set the width of the title box
  // j->SetTitleX(0); // Set the position of the title box
  // j->SetTitleY(0.985); // Set the position of the title box
  // j->SetTitleStyle(Style_t style = 1001);
  // j->SetTitleBorderSize(2);

// For the axis titles:

  j->SetTitleColor(1, "XYZ");
  j->SetTitleFont(42, "XYZ");
  //j->SetTitleSize(0.06, "XYZ");
  // j->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
  // j->SetTitleYSize(Float_t size = 0.02);
  j->SetTitleOffset(1.25,"X");
  j->SetTitleOffset(1.25,"Y");

// For the axis labels:

  j->SetLabelColor(1, "XYZ");
  j->SetLabelFont(42, "XYZ");
  j->SetLabelOffset(0.007, "XYZ");
  j->SetLabelSize(0.04, "XYZ");

// For the axis:

  j->SetAxisColor(1, "XYZ");
  j->SetStripDecimals(kTRUE);
  j->SetTickLength(0.03, "XYZ");
  j->SetNdivisions(510, "XYZ");
  j->SetPadTickX(0);  // To get tick marks on the opposite side of the frame
  j->SetPadTickY(0);

// Change for log plots:
  j->SetOptLogx(0);
  j->SetOptLogy(1);
  j->SetOptLogz(0);

// Postscript options:
  j->SetPaperSize(20.,20.);
  // j->SetLineScalePS(Float_t scale = 3);
  // j->SetLineStyleString(Int_t i, const char* text);
  // j->SetHeaderPS(const char* header);
  // j->SetTitlePS(const char* pstitle);

  // j->SetBarOffset(Float_t baroff = 0.5);
  // j->SetBarWidth(Float_t barwidth = 0.5);
  // j->SetPaintTextFormat(const char* format = "g");
  // j->SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
  // j->SetTimeOffset(Double_t toffset);
  // j->SetHistMinimumZero(kTRUE);

  j->cd();

}