[ROOT] line width in eps files

From: Hannes Sakulin (Hannes.Sakulin@cern.ch)
Date: Fri Feb 08 2002 - 12:15:40 MET


Hi,

I have the following problems with setting the linewidth of histograms when
I print them to an eps and later print the eps on the printer (ROOT
3.02/07):

1) On the screen and printout the linewidth of the histogram and of the line
in the legend are completely different. The one in the legend is much
bigger. The example below isllustrates this.

2) The line width on the printout depends on the size of the pad in which I
plot the histogram. If I change the height from 5. to 4.5 cm in the example
below than the readable line of width 2 becomes a hairline in the printout.

Could you please give me a hint how I can better control the line width in
the printout (e.g. independent of the pad size) and how I can get the same
line width in the histogram and legend.

Best Regards,
  Hannes Sakulin.



void test_lw()
{
  gStyle->SetPaperSize(16.5, 5.);
  TCanvas *cv_ovl= new TCanvas("cv_ovl","cv_ovl",1);
  cv_ovl->Size(16.5,5.); // change pad height here
  cv_ovl->cd();
  gPad->SetFillColor(0);
  gPad->SetBorderSize(0);
  gPad->SetBorderMode(0);
  gPad->SetGrid(1,1);
  gPad->SetTicks(1,0);
  gPad->Draw();
  gPad->Divide(2,1);
  gPad->cd(1);
  gStyle->SetOptStat(0);
  gPad->SetLeftMargin(0.18);
  gPad->SetRightMargin(0.07);
  gPad->SetBorderSize(0);

  TH1F* hGMT = new TH1F("xx","xx",10,0,10);
  hGMT->Fill(3.,70.);
  hGMT->Fill(4.,80.);
  hGMT->Fill(5.,90.);
  TH1F* hGMT1 = new TH1F("yy","yy",10,0,10);
  hGMT1->Fill(3.,72.);
  hGMT1->Fill(4.,78.);
  hGMT1->Fill(5.,93.);

  hGMT->SetMaximum(110.);
  hGMT->SetMinimum(60.);
  hGMT->SetLabelSize(0.07,"x");
  hGMT->SetLabelSize(0.07,"y");
  hGMT->SetLabelOffset(-0.005,"x");
  hGMT->SetTitle("");
  hGMT->GetXaxis()->SetTitleSize(0.07);
  hGMT->GetXaxis()->SetTitleOffset(0.5);
  hGMT->GetYaxis()->SetTitleSize(0.07);
  hGMT->SetXTitle("#eta_{gen}    ");
  hGMT->SetYTitle("Efficiency (%)    ");


  hGMT->SetLineColor(1);
  hGMT->SetLineWidth(3);
  hGMT->DrawCopy();

  hGMT1->SetLineColor(1);
  hGMT1->SetLineWidth(2);
  hGMT1->DrawCopy("SAME");

  TLegend* lab = new TLegend(0.64,0.16,0.91,0.42);
  lab->SetFillColor(0);
  lab->AddEntry(hGMT,"test test","L");
  lab->AddEntry(hGMT1,"test test","L");
  lab->Draw();

}





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hannes Sakulin
CERN / EP                           Phone: +41 22 767 7372
CH-1211 Geneva 23, Switzerland      Fax:   +41 22 767 8940
E-mail: Hannes.Sakulin@cern.ch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:41 MET