dear root helpdesk!
I’m working with root libraries within an ajax framework to present root plots via the web.
Right now i’m using the TH2D class to plot histograms.
the following problem:
my plot class gets a status string OK,ERROR,ND from a more lower framwork layer. the plot class assigns with a method a value to the string and these values are plotted in a root histogram (attached)
this is done as follows:
…
gStyle->SetOptStat(0);
gStyle->SetPalette(1);
gStyle->SetNumberContours(200);
TCanvas c1(“c1”,msg.str().c_str(),200,10,480,400);
c1.SetFillColor(kGray);
c1.cd(1);
c1.SetGrid();
TPad* pad = (TPad*)gPad;
pad->SetRightMargin(0.14);
TH2D *h2 = new TH2D(“h2”,msg.str().c_str(),6,0.,6.,12,0.,12.) ;
h2->SetBinContent(binNrX, binNrY, averageRates_[wedgeInVec][boardNr]) ;
h2->GetXaxis()->SetBinLabel(binNrX,boardKey_[boardNr].c_str());
h2->SetStats(0);
h2->GetXaxis()->SetTitle(“wheel”);
h2->GetYaxis()->SetTitle(“sector”);
h2->GetXaxis()->SetLabelSize(.04);
h2->GetYaxis()->SetLabelSize(.04);
h2->SetMinimum(0);
h2->Draw(“COLZ”);
c1.Update();
TPaletteAxis* palette;
palette = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject(“palette”);
palette->GetAxis()->SetTitle(“blue: not in the RUN - green: OK - red: ERROR”);
palette->SetLabelSize(0.03);
c1.Modified();
c1.Print(url.c_str());
…
what i want is to have instead of numbers according to colors seen in the palette to have just a string (OK, ERROR, NOT IN THE RUN) assigned to the color. (right now it is done with setTitle() but it looks not that good and the numbers lead to misunderstandings).
Is it possible to modify the palette labeling in this way? (i tried to get rid of the numbers with TPaletteAxis class but i didn’t find a solution)
Or would you have a suggestion how to modify the canvas to get a kind of legend where one can assign the color of the palette with a name/string? (i also checked the TLegend class but i didn’t find a solution)
thanks for help
best regards