Hi all,
I am trying to produce hatched histograms in a postscript file. The code
TCanvas* c = new TCanvas("c", "c");
TH1F* h = new TH1F("h","h",10, -4, 4);
h->FillRandom("gaus", 1000);
h->SetLineColor(kBlack);
h->SetFillStyle(3335);
h->SetFillColor(kBlack);
h->Draw();
TLegend* leg=new TLegend(0.7, 0.5, .95, 0.6);
leg->AddEntry(h, "Hatched hist", "f");
leg->Draw();
c->Print("hatch_tst.ps");
works fine if pasting it into the interactive ROOT-interpreter. However, trying to compile the same code (file hatch_tst.cc)
#include "TCanvas.h"
#include "TLegend.h"
#include "TH1F.h"
int main(void) {
TCanvas* c = new TCanvas("c", "c");
TH1F* h = new TH1F("h","h",10, -4, 4);
h->FillRandom("gaus", 1000);
h->SetLineColor(kBlack);
h->SetFillStyle(3335);
h->SetFillColor(kBlack);
h->Draw();
TLegend* leg=new TLegend(0.7, 0.5, .95, 0.6);
leg->AddEntry(h, "Hatched hist", "f");
leg->Draw();
c->Print("hatch_tst.ps");
return 0;
}
with
gcc -Wall -I/home/ersmark/sim/root/include/root -L/home/ersmark/sim/root/lib/root -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -ldl hatch_tst.cc -o hatch_tst
and running it produces a postscript without any hatching.
Any ideas how I can get this to work? Using the “bar” option when drawing the histogram works to produce a hatching of the histogram. The symbol in the legend isn’t hatched however.
(using ROOT 4.04.02b)
Thanks in advance.
Cheers,
Tore