diff --git a/hist/histpainter/src/TPaletteAxis.cxx b/hist/histpainter/src/TPaletteAxis.cxx index 84b8d44..8214a08 100644 --- a/hist/histpainter/src/TPaletteAxis.cxx +++ b/hist/histpainter/src/TPaletteAxis.cxx @@ -18,6 +18,7 @@ #include "TView.h" #include "TH1.h" #include "TGaxis.h" +#include "TLatex.h" ClassImp(TPaletteAxis); @@ -392,6 +393,15 @@ void TPaletteAxis::Paint(Option_t *) if (ndivz == 0) return; ndivz = TMath::Abs(ndivz); Int_t theColor, color; + // case option "CJUST": put labels directly at color boundaries + TLatex *label = NULL; + TString opt(fH->GetDrawOption()); + if (opt.Contains("CJUST")) { + label = new TLatex(); + label->SetTextFont(fH->GetZaxis()->GetLabelFont()); + label->SetTextColor(fH->GetZaxis()->GetLabelColor()); + label->SetTextAlign(kHAlignLeft+kVAlignCenter); + } Double_t scale = ndivz / (wlmax - wlmin); for (Int_t i = 0; i < ndivz; i++) { @@ -423,6 +433,19 @@ void TPaletteAxis::Paint(Option_t *) SetFillColor(gStyle->GetColorPalette(theColor)); TAttFill::Modify(); gPad->PaintBox(xmin, y1, xmax, y2); + // case option "CJUST": put labels directly + if (label) { + Double_t lof = 10.*fH->GetZaxis()->GetLabelOffset(); + Double_t lsize = fH->GetZaxis()->GetLabelSize(); + Double_t zlab = fH->GetContourLevel(i); + if (gPad->GetLogz()&& !fH->TestBit(TH1::kUserContour)) { + zlab = TMath::Power(10, zlab); + } + label->PaintLatex(xmax + lof, y1, 0, lsize, Form("%g", zlab)); + if (i == ndivz-1) { + label->PaintLatex(xmax + lof, y2, 0, lsize, Form("%g",fH->GetMaximum())); + } + } } Int_t ndiv = fH->GetZaxis()->GetNdivisions() % 100; //take primary divisions only char chopt[6] = "S "; @@ -437,8 +460,14 @@ void TPaletteAxis::Paint(Option_t *) wmax = TMath::Power(10., wlmax); strncat(chopt, "G", 2); } - fAxis.ImportAxisAttributes(fH->GetZaxis()); - fAxis.PaintAxis(xmax, ymin, xmax, ymax, wmin, wmax, ndiv, chopt); + // case option "CJUST" + if (label) { + delete label; + } else { + // default + fAxis.ImportAxisAttributes(fH->GetZaxis()); + fAxis.PaintAxis(xmax, ymin, xmax, ymax, wmin, wmax, ndiv, chopt); + } }