Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TPaletteAxis.cxx
Go to the documentation of this file.
1// @(#)root/histpainter:$Id$
2// Author: Rene Brun 15/11/2002
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TROOT.h"
13#include "TPaletteAxis.h"
14#include "TVirtualPad.h"
15#include "TVirtualX.h"
16#include "TStyle.h"
17#include "TMath.h"
18#include "TView.h"
19#include "TH1.h"
20#include "TGaxis.h"
21#include "TLatex.h"
22#include "snprintf.h"
23
24#include <iostream>
25
26
27
28////////////////////////////////////////////////////////////////////////////////
29
30/*! \class TPaletteAxis
31 \ingroup Histpainter
32 \brief The palette painting class.
33
34A `TPaletteAxis` object is used to display the color palette when
35drawing 2-d histograms.
36
37The `TPaletteAxis` is automatically created drawn when drawing a 2-D
38histogram when the option "Z" is specified.
39
40A `TPaletteAxis` object is added to the histogram list of functions and
41can be retrieved doing:
42
43 TPaletteAxis *palette = (TPaletteAxis*)h->GetListOfFunctions()->FindObject("palette");
44
45then the pointer `palette` can be used to change the palette attributes.
46
47Because the palette is created at painting time only, one must issue a:
48
49 gPad->Update();
50
51before retrieving the palette pointer in order to create the palette. The following
52macro gives an example.
53
54Begin_Macro(source)
55{
56 auto h2 = new TH2F("h2","Example of a resized palette ",40,-4,4,40,-20,20);
57 Float_t px, py;
58 for (Int_t i = 0; i < 25000; i++) {
59 gRandom->Rannor(px,py);
60 h2->Fill(px,5*py);
61 }
62 gStyle->SetPalette(1);
63 h2->Draw("COLZ");
64 gPad->Update();
65 auto palette = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject("palette");
66 palette->SetY2NDC(0.7);
67}
68End_Macro
69
70`TPaletteAxis` inherits from `TBox` and `TPave`. The methods
71allowing to specify the palette position are inherited from these two classes.
72
73The palette can be interactively moved and resized. The context menu
74can be used to set the axis attributes.
75
76It is possible to select a range on the axis to set the min/max in z
77
78As default labels and ticks are drawn by `TGAxis` at equidistant (lin or log)
79points as controlled by SetNdivisions.
80If option "CJUST" is given labels and ticks are justified at the
81color boundaries defined by the contour levels.
82In this case no optimization can be done. It is responsibility of the
83user to adjust minimum, maximum of the histogram and/or the contour levels
84to get a reasonable look of the plot.
85Only overlap of the labels is avoided if too many contour levels are used.
86
87This option is especially useful with user defined contours.
88An example is shown here:
89
90Begin_Macro(source)
91{
92 gStyle->SetOptStat(0);
93 auto c = new TCanvas("c","exa_CJUST",300,10,400,400);
94 auto hpxpy = new TH2F("hpxpy","py vs px",40,-4,4,40,-4,4);
95 // Fill histograms randomly
96 TRandom3 randomNum;
97 Float_t px, py;
98 for (Int_t i = 0; i < 25000; i++) {
99 randomNum.Rannor(px,py);
100 hpxpy->Fill(px,py);
101 }
102 hpxpy->SetMaximum(200);
103 Double_t zcontours[5] = {0, 20, 40, 80, 120};
104 hpxpy->SetContour(5, zcontours);
105 hpxpy->GetZaxis()->SetTickSize(0.01);
106 hpxpy->GetZaxis()->SetLabelOffset(0.01);
107 gPad->SetRightMargin(0.13);
108 hpxpy->SetTitle("User contours, CJUST");
109 hpxpy->Draw("COL Z CJUST");
110}
111End_Macro
112*/
113
114
115////////////////////////////////////////////////////////////////////////////////
116/// Palette default constructor.
117
119{
120 fH = nullptr;
121 SetName("");
122}
123
124
125////////////////////////////////////////////////////////////////////////////////
126/// Palette normal constructor.
127
129 : TPave(x1, y1, x2, y2)
130{
131 fH = h;
132 if (!fH) return;
133 SetName("palette");
134 TAxis *zaxis = fH->GetZaxis();
136 if (gPad->GetView()) SetBit(kHasView);
137}
138
139
140////////////////////////////////////////////////////////////////////////////////
141/// Palette normal constructor.
142
144 : TPave(x1, y1, x2, y2)
145{
146 fH = nullptr;
147 fAxis.SetWmin(min);
148 fAxis.SetWmax(max);
149 SetName("palette");
150 if (gPad->GetView()) SetBit(kHasView);
151}
152
153
154////////////////////////////////////////////////////////////////////////////////
155/// Palette normal constructor.
156
158 : TPave(x1, y1, x2, y2)
159{
160 fH = nullptr;
161 SetName("palette");
163 if (gPad->GetView()) SetBit(kHasView);
164}
165
166
167////////////////////////////////////////////////////////////////////////////////
168/// Palette destructor.
169
173
174
175////////////////////////////////////////////////////////////////////////////////
176/// Palette copy constructor.
177
179{
180 palette.TPaletteAxis::Copy(*this);
181}
182
183
184////////////////////////////////////////////////////////////////////////////////
185/// Assignment operator.
186
188{
189 if (this != &orig)
190 orig.TPaletteAxis::Copy(*this);
191 return *this;
192}
193
194
195////////////////////////////////////////////////////////////////////////////////
196/// Copy a palette to a palette.
197
199{
200 TPave::Copy(obj);
201 ((TPaletteAxis&)obj).fH = fH;
202}
203
204
205////////////////////////////////////////////////////////////////////////////////
206/// Check if mouse on the axis region.
207
209{
210 Int_t plxmax = gPad->XtoAbsPixel(fX2);
211 Int_t plymin = gPad->YtoAbsPixel(fY1);
212 Int_t plymax = gPad->YtoAbsPixel(fY2);
213 if (px > plxmax && px < plxmax + 30 && py >= plymax && py <= plymin) return px - plxmax;
214
215 //otherwise check if inside the box
216 return TPave::DistancetoPrimitive(px, py);
217}
218
219
220////////////////////////////////////////////////////////////////////////////////
221/// Check if mouse on the axis region.
222
224{
225 if (!gPad) return;
226
227 static Int_t kmode = 0;
228 Int_t plxmin = gPad->XtoAbsPixel(fX1);
229 Int_t plxmax = gPad->XtoAbsPixel(fX2);
230 if (kmode != 0 || px <= plxmax) {
231 if (event == kButton1Down) kmode = 1;
232 TBox::ExecuteEvent(event, px, py);
233 if (event == kButton1Up) kmode = 0;
234 // In case palette coordinates have been modified, recompute NDC coordinates
235 Double_t dpx = gPad->GetX2() - gPad->GetX1();
236 Double_t dpy = gPad->GetY2() - gPad->GetY1();
237 Double_t xp1 = gPad->GetX1();
238 Double_t yp1 = gPad->GetY1();
239 fX1NDC = (fX1 - xp1) / dpx;
240 fY1NDC = (fY1 - yp1) / dpy;
241 fX2NDC = (fX2 - xp1) / dpx;
242 fY2NDC = (fY2 - yp1) / dpy;
243 return;
244 }
245 gPad->SetCursor(kHand);
246 static Double_t ratio1, ratio2;
247 static Int_t px1old, py1old, px2old, py2old;
248 Double_t temp, xmin, xmax;
249
250 switch (event) {
251
252 case kButton1Down:
253 ratio1 = (gPad->AbsPixeltoY(py) - fY1) / (fY2 - fY1);
254 py1old = gPad->YtoAbsPixel(fY1 + ratio1 * (fY2 - fY1));
255 px1old = plxmin;
256 px2old = plxmax;
257 py2old = py1old;
259 gVirtualX->SetLineColor(-1);
260 // No break !!!
261
262 case kButton1Motion:
264 ratio2 = (gPad->AbsPixeltoY(py) - fY1) / (fY2 - fY1);
265 py2old = gPad->YtoAbsPixel(fY1 + ratio2 * (fY2 - fY1));
267 break;
268
269 case kButton1Up:
270 if (gROOT->IsEscaped()) {
271 gROOT->SetEscape(kFALSE);
272 break;
273 }
274
275 ratio2 = (gPad->AbsPixeltoY(py) - fY1) / (fY2 - fY1);
276 xmin = ratio1;
277 xmax = ratio2;
278 if (xmin > xmax) {
279 temp = xmin;
280 xmin = xmax;
281 xmax = temp;
282 temp = ratio1;
283 ratio1 = ratio2;
284 ratio2 = temp;
285 }
286 if (ratio2 - ratio1 > 0.05) {
287 if (fH) {
288 if (fH->GetDimension() == 2) {
289 Double_t zmin = fH->GetMinimum();
290 Double_t zmax = fH->GetMaximum();
291 if (gPad->GetLogz()) {
292 if (zmin <= 0 && zmax > 0) zmin = TMath::Min((Double_t)1,
293 (Double_t)0.001 * zmax);
294 zmin = TMath::Log10(zmin);
295 zmax = TMath::Log10(zmax);
296 }
297 Double_t newmin = zmin + (zmax - zmin) * ratio1;
298 Double_t newmax = zmin + (zmax - zmin) * ratio2;
299 if (newmin < zmin)newmin = fH->GetBinContent(fH->GetMinimumBin());
300 if (newmax > zmax)newmax = fH->GetBinContent(fH->GetMaximumBin());
301 if (gPad->GetLogz()) {
302 newmin = TMath::Exp(2.302585092994 * newmin);
303 newmax = TMath::Exp(2.302585092994 * newmax);
304 }
308 }
309 }
310 gPad->Modified(kTRUE);
311 }
312 gVirtualX->SetLineColor(-1);
313 kmode = 0;
314 break;
315 }
316}
317
318
319////////////////////////////////////////////////////////////////////////////////
320/// Returns the color index of the bin (i,j).
321///
322/// This function should be used after an histogram has been plotted with the
323/// option COL or COLZ like in the following example:
324///
325/// h2->Draw("COLZ");
326/// gPad->Update();
327/// TPaletteAxis *palette = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject("palette");
328/// Int_t ci = palette->GetBinColor(20,15);
329///
330/// Then it is possible to retrieve the RGB components in the following way:
331///
332/// TColor *c = gROOT->GetColor(ci);
333/// float x,y,z;
334/// c->GetRGB(x,y,z);
335
337{
338 if (!fH) return 0;
340 return GetValueColor(zc);
341}
342
343
344////////////////////////////////////////////////////////////////////////////////
345/// Displays the z value corresponding to cursor position py.
346
347char *TPaletteAxis::GetObjectInfo(Int_t /* px */, Int_t py) const
348{
349 Double_t z;
350 static char info[64];
351
352 Double_t zmin = 0.;
353 Double_t zmax = 0.;
354 if (fH) {
355 zmin = fH->GetMinimum();
356 zmax = fH->GetMaximum();
357 }
358 Int_t y1 = gPad->GetWh() - gPad->VtoPixel(fY1NDC);
359 Int_t y2 = gPad->GetWh() - gPad->VtoPixel(fY2NDC);
360 Int_t y = gPad->GetWh() - py;
361
362 if (gPad->GetLogz()) {
363 if (zmin <= 0 && zmax > 0) zmin = TMath::Min((Double_t)1,
364 (Double_t)0.001 * zmax);
367 Double_t zl = (zmaxl - zminl) * ((Double_t)(y - y1) / (Double_t)(y2 - y1)) + zminl;
368 z = TMath::Power(10., zl);
369 } else {
370 z = (zmax - zmin) * ((Double_t)(y - y1) / (Double_t)(y2 - y1)) + zmin;
371 }
372
373 snprintf(info, 64, "(z=%g)", z);
374 return info;
375}
376
377
378////////////////////////////////////////////////////////////////////////////////
379/// Returns the color index of the given z value
380///
381/// This function should be used after an histogram has been plotted with the
382/// option COL or COLZ like in the following example:
383///
384/// h2->Draw("COLZ");
385/// gPad->Update();
386/// TPaletteAxis *palette = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject("palette");
387/// Int_t ci = palette->GetValueColor(30.);
388///
389/// Then it is possible to retrieve the RGB components in the following way:
390///
391/// TColor *c = gROOT->GetColor(ci);
392/// float x,y,z;
393/// c->GetRGB(x,y,z);
394
396{
397 if (!fH) return 0;
398
403
404 if (gPad->GetLogz()) {
406 (Double_t)0.001 * wmax);
409 }
410
411 Int_t ncolors = gStyle->GetNumberOfColors();
412 Int_t ndivz =0;
413 if (fH) ndivz = fH->GetContour();
414 if (ndivz == 0) return 0;
416 Int_t theColor, color;
418
419 if (fH->TestBit(TH1::kUserContour) && gPad->GetLogz()) zc = TMath::Log10(zc);
420 if (zc < wlmin) zc = wlmin;
421
422 color = Int_t(0.01 + (zc - wlmin) * scale);
423
424 theColor = Int_t((color + 0.99) * Double_t(ncolors) / Double_t(ndivz));
426}
427
428
429////////////////////////////////////////////////////////////////////////////////
430/// Paint the palette.
431
433{
435
436 SetFillStyle(1001);
437 Double_t ymin = fY1;
438 Double_t ymax = fY2;
439 Double_t xmin = fX1;
440 Double_t xmax = fX2;
442 if (fH) {
443 wmin = fH->GetMinimum();
444 wmax = fH->GetMaximum();
445 } else {
446 wmin = fAxis.GetWmin();
447 wmax = fAxis.GetWmax();
448 }
451 Double_t b1, b2, w1, w2, zc;
452 Bool_t kHorizontal = false;
453
454 if ((wlmax - wlmin) <= 0) {
455 Double_t mz = wlmin * 0.1;
456 if (mz == 0) mz = 0.1;
457 wlmin = wlmin - mz;
458 wlmax = wlmax + mz;
459 wmin = wlmin;
460 wmax = wlmax;
461 }
462
463 if (GetX2NDC()-GetX1NDC() > GetY2NDC()-GetY1NDC()) kHorizontal = true;
464
465 if (gPad->GetLogz()) {
469 }
470 Double_t ws = wlmax - wlmin;
471 Int_t ncolors = gStyle->GetNumberOfColors();
472 Int_t ndivz;
473 if (fH) ndivz = fH->GetContour();
474 else ndivz = ncolors;
475 if (ndivz == 0) return;
477 Int_t theColor, color;
478 // import Attributes already here since we might need them for CJUST
479 if (fH && fH->GetDimension() == 2) {
482 if (ztit.Index(";")>0) {
483 ztit.Remove(ztit.Index(";"),ztit.Length());
484 fAxis.SetTitle(ztit.Data());
485 }
486 }
487 // the 3D histogram's title is stored in Zaxis
488 if (fH && fH->GetDimension() > 2) {
490 fAxis.SetTitle("");
491 if (ztit.Index(";")>0) {
492 ztit.Remove(0,ztit.Index(";")+1);
493 fAxis.SetTitle(ztit.Data());
494 }
495 }
496 // case option "CJUST": put labels directly at color boundaries
497 TLatex *label = nullptr;
498 TLine *line = nullptr;
499 Double_t prevlab = 0;
500 if (fH) {
501 TString opt(fH->GetDrawOption());
502 if (opt.Contains("CJUST", TString::kIgnoreCase)) {
503 label = new TLatex();
506 if (kHorizontal) label->SetTextAlign(kHAlignCenter+kVAlignTop);
508 line = new TLine();
510 if (kHorizontal) line->PaintLine(xmin, ymin, xmax, ymin);
511 else line->PaintLine(xmax, ymin, xmax, ymax);
512 }
513 }
515 Double_t dw = (wlmax - wlmin) / ndivz;
516 for (Int_t i = 0; i < ndivz; i++) {
517
518 if (fH) zc = fH->GetContourLevel(i);
519 else zc = wlmin + i*dw;
520 if (fH && fH->TestBit(TH1::kUserContour) && gPad->GetLogz())
521 zc = TMath::Log10(zc);
522 w1 = zc;
523 if (w1 < wlmin) w1 = wlmin;
524
525 w2 = wlmax;
526 if (i < ndivz - 1) {
527 if (fH) zc = fH->GetContourLevel(i + 1);
528 else zc = wlmin + (i+1)*dw;
529 if (fH && fH->TestBit(TH1::kUserContour) && gPad->GetLogz())
530 zc = TMath::Log10(zc);
531 w2 = zc;
532 }
533
534 if (w2 <= wlmin) continue;
535 if (kHorizontal) {
536 b1 = xmin + (w1 - wlmin) * (xmax - xmin) / ws;
537 b2 = xmin + (w2 - wlmin) * (xmax - xmin) / ws;
538 } else {
539 b1 = ymin + (w1 - wlmin) * (ymax - ymin) / ws;
540 b2 = ymin + (w2 - wlmin) * (ymax - ymin) / ws;
541 }
542
543 if (fH && fH->TestBit(TH1::kUserContour)) {
544 color = i;
545 } else {
546 color = Int_t(0.01 + (w1 - wlmin) * scale);
547 }
548
549 theColor = Int_t((color + 0.99) * Double_t(ncolors) / Double_t(ndivz));
552 if (kHorizontal) gPad->PaintBox(b1, ymin, b2, ymax);
553 else gPad->PaintBox(xmin, b1, xmax, b2);
554 // case option "CJUST": put labels directly
555 if (fH && label) {
556 Double_t lof = fAxis.GetLabelOffset()*(gPad->GetUxmax()-gPad->GetUxmin());
557 // the following assumes option "S"
558 Double_t tlength = fAxis.GetTickSize() * (gPad->GetUxmax()-gPad->GetUxmin());
560 Double_t lsize_user = lsize*(gPad->GetUymax()-gPad->GetUymin());
562 if (gPad->GetLogz()&& !fH->TestBit(TH1::kUserContour)) {
563 zlab = TMath::Power(10, zlab);
564 }
565 // make sure labels dont overlap
566 if (i == 0 || (b1 - prevlab) > 1.5*lsize_user) {
567 if (kHorizontal) label->PaintLatex(b1, ymin - lof, 0, lsize, TString::Format("%g", zlab));
568 else label->PaintLatex(xmax + lof, b1, 0, lsize, TString::Format("%g", zlab));
569 prevlab = b1;
570 }
571 if (kHorizontal) line->PaintLine(b2, ymin+tlength, b2, ymin);
572 else line->PaintLine(xmax-tlength, b1, xmax, b1);
573 if (i == ndivz-1) {
574 // label + tick at top of axis
575 if (fH && (b2 - prevlab > 1.5*lsize_user)) {
576 if (kHorizontal) label->PaintLatex(b2, ymin - lof, 0, lsize, TString::Format("%g",fH->GetMaximum()));
577 else label->PaintLatex(xmax + lof, b2, 0, lsize, TString::Format("%g",fH->GetMaximum()));
578 }
579 if (kHorizontal) line->PaintLine(b1, ymin+tlength, b1, ymin);
580 else line->PaintLine(xmax-tlength, b2, xmax, b2);
581 }
582 }
583 }
584
585 // Take primary divisions only
586 Int_t ndiv;
587 if (fH) ndiv = fH->GetZaxis()->GetNdivisions();
588 else ndiv = fAxis.GetNdiv();
589 Bool_t isOptimized = ndiv>0;
590 Int_t absDiv = abs(ndiv);
591 Int_t maxD = absDiv/1000000;
592 ndiv = absDiv%100 + maxD*1000000;
593 if (!isOptimized) ndiv = -ndiv;
594
595 char chopt[6] = "S ";
596 chopt[1] = 0;
597 strncat(chopt, "+L", 3);
598 if (ndiv < 0) {
599 ndiv = TMath::Abs(ndiv);
600 strncat(chopt, "N", 2);
601 }
602 if (gPad->GetLogz()) {
603 wmin = TMath::Power(10., wlmin);
604 wmax = TMath::Power(10., wlmax);
605 strncat(chopt, "G", 2);
606 }
607 if (label) {
608 // case option "CJUST", cleanup
609 delete label;
610 delete line;
611 } else {
612 // default
613 if (kHorizontal) fAxis.PaintAxis(xmin, ymin, xmax, ymin, wmin, wmax, ndiv, chopt);
614 else fAxis.PaintAxis(xmax, ymin, xmax, ymax, wmin, wmax, ndiv, chopt);
615 }
616}
617
618
619////////////////////////////////////////////////////////////////////////////////
620/// Save primitive as a C++ statement(s) on output stream out.
621
622void TPaletteAxis::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
623{
624 if (!fH)
625 return;
626
628 out << " palette->SetNdivisions(" << fH->GetZaxis()->GetNdivisions() << ");\n";
629 out << " palette->SetAxisColor(" << TColor::SavePrimitiveColor(fH->GetZaxis()->GetAxisColor()) << ");\n";
630 out << " palette->SetLabelColor(" << TColor::SavePrimitiveColor(fH->GetZaxis()->GetLabelColor()) << ");\n";
631 out << " palette->SetLabelFont(" << fH->GetZaxis()->GetLabelFont() << ");\n";
632 out << " palette->SetLabelOffset(" << fH->GetZaxis()->GetLabelOffset() << ");\n";
633 out << " palette->SetLabelSize(" << fH->GetZaxis()->GetLabelSize() << ");\n";
634 out << " palette->SetMaxDigits(" << fH->GetZaxis()->GetMaxDigits() << ");\n";
635 out << " palette->SetTickLength(" << fH->GetZaxis()->GetTickLength() << ");\n";
636 out << " palette->SetTitleOffset(" << fH->GetZaxis()->GetTitleOffset() << ");\n";
637 out << " palette->SetTitleSize(" << fH->GetZaxis()->GetTitleSize() << ");\n";
638 out << " palette->SetTitleColor(" << TColor::SavePrimitiveColor(fH->GetZaxis()->GetTitleColor()) << ");\n";
639 out << " palette->SetTitleFont(" << fH->GetZaxis()->GetTitleFont() << ");\n";
640 out << " palette->SetTitle(\"" << TString(fH->GetZaxis()->GetTitle()).ReplaceSpecialCppChars() << "\");\n";
641 SaveFillAttributes(out, "palette", -1, -1);
642 SaveLineAttributes(out, "palette", 1, 1, 1);
643}
644
645////////////////////////////////////////////////////////////////////////////////
646/// Unzoom the palette
647
649{
650 if (!fH)
651 return;
652 // if view exists - it will be deleted
653 if (gPad)
654 gPad->SetView(nullptr);
655 fH->GetZaxis()->SetRange(0, 0);
656 if (fH->GetDimension() == 2) {
657 fH->SetMinimum();
658 fH->SetMaximum();
660 }
661}
@ kButton1Motion
Definition Buttons.h:20
@ kButton1Up
Definition Buttons.h:19
@ kButton1Down
Definition Buttons.h:17
@ kHand
Definition GuiTypes.h:374
#define h(i)
Definition RSha256.hxx:106
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
@ kVAlignTop
Definition TAttText.h:58
@ kVAlignCenter
Definition TAttText.h:58
@ kHAlignLeft
Definition TAttText.h:57
@ kHAlignCenter
Definition TAttText.h:57
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t SetFillStyle
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmin
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t SetFillColor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmax
Option_t Option_t TPoint TPoint const char y1
float xmin
float ymin
float xmax
float ymax
#define gROOT
Definition TROOT.h:411
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
#define gPad
#define gVirtualX
Definition TVirtualX.h:337
#define snprintf
Definition civetweb.c:1579
virtual Color_t GetTitleColor() const
Definition TAttAxis.h:47
virtual Color_t GetLabelColor() const
Definition TAttAxis.h:39
virtual Int_t GetNdivisions() const
Definition TAttAxis.h:37
virtual Color_t GetAxisColor() const
Definition TAttAxis.h:38
virtual Style_t GetTitleFont() const
Definition TAttAxis.h:48
virtual Float_t GetLabelOffset() const
Definition TAttAxis.h:41
virtual Int_t GetMaxDigits() const
Definition TAttAxis.h:43
virtual Style_t GetLabelFont() const
Definition TAttAxis.h:40
virtual Float_t GetTitleSize() const
Definition TAttAxis.h:45
virtual Float_t GetLabelSize() const
Definition TAttAxis.h:42
virtual Float_t GetTickLength() const
Definition TAttAxis.h:46
virtual Float_t GetTitleOffset() const
Definition TAttAxis.h:44
virtual void Modify()
Change current fill area attributes if necessary.
Definition TAttFill.cxx:215
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
Definition TAttFill.cxx:238
virtual Color_t GetLineColor() const
Return the line color.
Definition TAttLine.h:35
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:42
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
Definition TAttLine.cxx:274
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition TAttText.h:44
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition TAttText.h:46
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition TAttText.h:48
Class to manage histogram axis.
Definition TAxis.h:32
const char * GetTitle() const override
Returns title of object.
Definition TAxis.h:137
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis using bin numbers.
Definition TAxis.cxx:1045
Double_t fX1
X of 1st point.
Definition TBox.h:28
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TBox.cxx:231
Double_t fY2
Y of 2nd point.
Definition TBox.h:31
Double_t fX2
X of 2nd point.
Definition TBox.h:30
Double_t fY1
Y of 1st point.
Definition TBox.h:29
static TString SavePrimitiveColor(Int_t ci)
Convert color in C++ statement which can be used in SetColor directives Produced statement either inc...
Definition TColor.cxx:2556
virtual void PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, Double_t &wmin, Double_t &wmax, Int_t &ndiv, Option_t *chopt="", Double_t gridlength=0, Bool_t drawGridOnly=kFALSE)
Control function to draw an axis.
Definition TGaxis.cxx:1007
Double_t GetWmin() const
Definition TGaxis.h:91
virtual void SetTitle(const char *title="")
Change the title of the axis.
Definition TGaxis.cxx:2916
Float_t GetLabelOffset() const
Definition TGaxis.h:82
virtual void ImportAxisAttributes(TAxis *axis)
Internal method to import TAxis attributes to this TGaxis.
Definition TGaxis.cxx:954
Int_t GetLabelFont() const
Definition TGaxis.h:81
const char * GetTitle() const override
Returns title of object.
Definition TGaxis.h:88
void SetWmax(Double_t wmax)
Definition TGaxis.h:135
Int_t GetLabelColor() const
Definition TGaxis.h:80
Float_t GetTickSize() const
Definition TGaxis.h:93
void SetWmin(Double_t wmin)
Definition TGaxis.h:134
Int_t GetNdiv() const
Definition TGaxis.h:90
Double_t GetWmax() const
Definition TGaxis.h:92
Float_t GetLabelSize() const
Definition TGaxis.h:83
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:109
TAxis * GetZaxis()
Definition TH1.h:574
virtual Int_t GetDimension() const
Definition TH1.h:528
@ kUserContour
User specified contour levels.
Definition TH1.h:405
@ kIsZoomed
Bit set when zooming on Y axis.
Definition TH1.h:408
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
Definition TH1.cxx:8586
virtual void SetMaximum(Double_t maximum=-1111)
Definition TH1.h:653
virtual void SetMinimum(Double_t minimum=-1111)
Definition TH1.h:654
virtual Int_t GetMaximumBin() const
Return location of bin with maximum value in the range.
Definition TH1.cxx:8618
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition TH1.cxx:5076
virtual Int_t GetContour(Double_t *levels=nullptr)
Return contour values into array levels if pointer levels is non zero.
Definition TH1.cxx:8452
virtual Double_t GetContourLevel(Int_t level) const
Return value of contour number level.
Definition TH1.cxx:8471
virtual Int_t GetMinimumBin() const
Return location of bin with minimum value in the range.
Definition TH1.cxx:8706
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Return minimum value larger than minval of bins in the range, unless the value has been overridden by...
Definition TH1.cxx:8676
To draw Mathematical Formula.
Definition TLatex.h:18
virtual void PaintLatex(Double_t x, Double_t y, Double_t angle, Double_t size, const char *text)
Main drawing function.
Definition TLatex.cxx:2113
Use the TLine constructor to create a simple line.
Definition TLine.h:22
virtual void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
Definition TLine.cxx:428
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
Mother of all ROOT objects.
Definition TObject.h:41
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:202
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
Definition TObject.cxx:441
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:864
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
Definition TObject.cxx:771
void ResetBit(UInt_t f)
Definition TObject.h:201
The palette painting class.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Check if mouse on the axis region.
void Paint(Option_t *option="") override
Paint the palette.
TGaxis fAxis
Palette axis.
TPaletteAxis & operator=(const TPaletteAxis &)
Assignment operator.
~TPaletteAxis() override
Palette destructor.
char * GetObjectInfo(Int_t px, Int_t py) const override
Displays the z value corresponding to cursor position py.
TPaletteAxis()
Palette default constructor.
Int_t GetBinColor(Int_t i, Int_t j)
Returns the color index of the bin (i,j).
void Copy(TObject &palette) const override
Copy a palette to a palette.
TH1 * fH
! Pointer to parent histogram
virtual void UnZoom()
Unzoom the palette.
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Check if mouse on the axis region.
Int_t GetValueColor(Double_t zc)
Returns the color index of the given z value.
static TClass * Class()
A TBox with a bordersize and a shadow option.
Definition TPave.h:19
Double_t GetY2NDC() const
Definition TPave.h:64
virtual void ConvertNDCtoPad()
Convert pave coordinates from NDC to Pad coordinates.
Definition TPave.cxx:138
Double_t GetX2NDC() const
Definition TPave.h:62
TString GetSavePaveArgs(const char *extra_arg=nullptr, Bool_t save_option=kTRUE)
Returns arguments which should be used when saving primitive constructor Check if coordinates are ini...
Definition TPave.cxx:617
void Copy(TObject &pave) const override
Copy this pave to pave.
Definition TPave.cxx:185
virtual void SetName(const char *name="")
Definition TPave.h:81
Double_t fX2NDC
X2 point in NDC coordinates.
Definition TPave.h:24
Double_t GetY1NDC() const
Definition TPave.h:63
Double_t fY2NDC
Y2 point in NDC coordinates.
Definition TPave.h:25
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a pave.
Definition TPave.cxx:207
Double_t fX1NDC
X1 point in NDC coordinates.
Definition TPave.h:22
Double_t fY1NDC
Y1 point in NDC coordinates.
Definition TPave.h:23
Double_t GetX1NDC() const
Definition TPave.h:61
Basic string class.
Definition TString.h:138
TString & ReplaceSpecialCppChars()
Find special characters which are typically used in printf() calls and replace them by appropriate es...
Definition TString.cxx:1121
@ kIgnoreCase
Definition TString.h:285
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2384
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:640
Int_t GetColorPalette(Int_t i) const
Return color number i in current palette.
Definition TStyle.cxx:1102
Int_t GetNumberOfColors() const
Return number of colors in the color palette.
Definition TStyle.cxx:1176
TLine * line
Double_t y[n]
Definition legend1.C:17
Double_t Exp(Double_t x)
Returns the base-e exponential function of x, which is e raised to the power x.
Definition TMath.h:720
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Definition TMath.h:732
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:199
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Definition TMath.h:773
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:124