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 fLog = 0;
122 SetName("");
123}
124
125
126////////////////////////////////////////////////////////////////////////////////
127/// Palette normal constructor.
128
130 : TPave(x1, y1, x2, y2)
131{
132 fH = h;
133 fLog = 0;
134 if (!fH) return;
135 SetName("palette");
136 TAxis *zaxis = fH->GetZaxis();
138 if (gPad->GetView()) SetBit(kHasView);
139}
140
141
142////////////////////////////////////////////////////////////////////////////////
143/// Palette normal constructor.
144
146 : TPave(x1, y1, x2, y2)
147{
148 fH = nullptr;
149 fLog = 0;
150 fAxis.SetWmin(min);
151 fAxis.SetWmax(max);
152 SetName("palette");
153 if (gPad->GetView()) SetBit(kHasView);
154}
155
156
157////////////////////////////////////////////////////////////////////////////////
158/// Palette normal constructor.
159
161 : TPave(x1, y1, x2, y2)
162{
163 fH = nullptr;
164 fLog = 0;
165 SetName("palette");
167 if (gPad->GetView()) SetBit(kHasView);
168}
169
170
171////////////////////////////////////////////////////////////////////////////////
172/// Palette destructor.
173
177
178
179////////////////////////////////////////////////////////////////////////////////
180/// Palette copy constructor.
181
183{
184 palette.TPaletteAxis::Copy(*this);
185}
186
187
188////////////////////////////////////////////////////////////////////////////////
189/// Assignment operator.
190
192{
193 if (this != &orig)
194 orig.TPaletteAxis::Copy(*this);
195 return *this;
196}
197
198
199////////////////////////////////////////////////////////////////////////////////
200/// Copy a palette to a palette.
201
203{
204 TPave::Copy(obj);
205 ((TPaletteAxis&)obj).fH = fH;
206}
207
208
209////////////////////////////////////////////////////////////////////////////////
210/// Check if mouse on the axis region.
211
213{
214 Int_t plxmax = gPad->XtoAbsPixel(fX2);
215 Int_t plymin = gPad->YtoAbsPixel(fY1);
216 Int_t plymax = gPad->YtoAbsPixel(fY2);
217 if (px > plxmax && px < plxmax + 30 && py >= plymax && py <= plymin) return px - plxmax;
218
219 //otherwise check if inside the box
220 return TPave::DistancetoPrimitive(px, py);
221}
222
223
224////////////////////////////////////////////////////////////////////////////////
225/// Check if mouse on the axis region.
226
228{
229 if (!gPad) return;
230
231 static Int_t kmode = 0;
232 Int_t plxmin = gPad->XtoAbsPixel(fX1);
233 Int_t plxmax = gPad->XtoAbsPixel(fX2);
234 if (kmode != 0 || px <= plxmax) {
235 if (event == kButton1Down) kmode = 1;
236 TBox::ExecuteEvent(event, px, py);
237 if (event == kButton1Up) kmode = 0;
238 // In case palette coordinates have been modified, recompute NDC coordinates
239 Double_t dpx = gPad->GetX2() - gPad->GetX1();
240 Double_t dpy = gPad->GetY2() - gPad->GetY1();
241 Double_t xp1 = gPad->GetX1();
242 Double_t yp1 = gPad->GetY1();
243 fX1NDC = (fX1 - xp1) / dpx;
244 fY1NDC = (fY1 - yp1) / dpy;
245 fX2NDC = (fX2 - xp1) / dpx;
246 fY2NDC = (fY2 - yp1) / dpy;
247 return;
248 }
249 gPad->SetCursor(kHand);
250 static Double_t ratio1, ratio2;
251 static Int_t px1old, py1old, px2old, py2old;
252 Double_t temp, xmin, xmax;
253
254 switch (event) {
255
256 case kButton1Down:
257 ratio1 = (gPad->AbsPixeltoY(py) - fY1) / (fY2 - fY1);
258 py1old = gPad->YtoAbsPixel(fY1 + ratio1 * (fY2 - fY1));
259 px1old = plxmin;
260 px2old = plxmax;
261 py2old = py1old;
263 gVirtualX->SetLineColor(-1);
264 // No break !!!
265
266 case kButton1Motion:
268 ratio2 = (gPad->AbsPixeltoY(py) - fY1) / (fY2 - fY1);
269 py2old = gPad->YtoAbsPixel(fY1 + ratio2 * (fY2 - fY1));
271 break;
272
273 case kButton1Up:
274 if (gROOT->IsEscaped()) {
275 gROOT->SetEscape(kFALSE);
276 break;
277 }
278
279 ratio2 = (gPad->AbsPixeltoY(py) - fY1) / (fY2 - fY1);
280 xmin = ratio1;
281 xmax = ratio2;
282 if (xmin > xmax) {
283 temp = xmin;
284 xmin = xmax;
285 xmax = temp;
286 temp = ratio1;
287 ratio1 = ratio2;
288 ratio2 = temp;
289 }
290 if (ratio2 - ratio1 > 0.05) {
291 if (fH) {
292 if (fH->GetDimension() == 2) {
293 Double_t zmin = fH->GetMinimum();
294 Double_t zmax = fH->GetMaximum();
295 if (GetLog()) {
296 if (zmin <= 0 && zmax > 0) zmin = TMath::Min((Double_t)1,
297 (Double_t)0.001 * zmax);
298 zmin = TMath::Log10(zmin);
299 zmax = TMath::Log10(zmax);
300 }
301 Double_t newmin = zmin + (zmax - zmin) * ratio1;
302 Double_t newmax = zmin + (zmax - zmin) * ratio2;
303 if (newmin < zmin)newmin = fH->GetBinContent(fH->GetMinimumBin());
304 if (newmax > zmax)newmax = fH->GetBinContent(fH->GetMaximumBin());
305 if (GetLog()) {
306 newmin = TMath::Exp(2.302585092994 * newmin);
307 newmax = TMath::Exp(2.302585092994 * newmax);
308 }
312 }
313 }
314 gPad->Modified(kTRUE);
315 }
316 gVirtualX->SetLineColor(-1);
317 kmode = 0;
318 break;
319 }
320}
321
322////////////////////////////////////////////////////////////////////////////////
323/// Returns whether the palette is in log scale.
324///
325/// By default, the palette axis is logarithmic if the TPad's option Logz is set.
326/// However, in some cases, such as with TScatter2D, the color represents a fourth dimension,
327/// and the log scale is not defined by the Z axis but by a dedicated setting specified
328/// through a separate option.
329///
330/// This method handles these various cases and returns the correct state of the palette axis.
331
333{
334 if (fLog == 0) return gPad->GetLogz();
335 return fLog-1;
336}
337
338////////////////////////////////////////////////////////////////////////////////
339/// Returns the color index of the bin (i,j).
340///
341/// This function should be used after an histogram has been plotted with the
342/// option COL or COLZ like in the following example:
343///
344/// h2->Draw("COLZ");
345/// gPad->Update();
346/// TPaletteAxis *palette = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject("palette");
347/// Int_t ci = palette->GetBinColor(20,15);
348///
349/// Then it is possible to retrieve the RGB components in the following way:
350///
351/// TColor *c = gROOT->GetColor(ci);
352/// float x,y,z;
353/// c->GetRGB(x,y,z);
354
356{
357 if (!fH) return 0;
359 return GetValueColor(zc);
360}
361
362
363////////////////////////////////////////////////////////////////////////////////
364/// Displays the z value corresponding to cursor position py.
365
366char *TPaletteAxis::GetObjectInfo(Int_t /* px */, Int_t py) const
367{
368 Double_t z;
369 static char info[64];
370
371 Double_t zmin = 0.;
372 Double_t zmax = 0.;
373 if (fH) {
374 zmin = fH->GetMinimum();
375 zmax = fH->GetMaximum();
376 }
377 Int_t y1 = gPad->GetWh() - gPad->VtoPixel(fY1NDC);
378 Int_t y2 = gPad->GetWh() - gPad->VtoPixel(fY2NDC);
379 Int_t y = gPad->GetWh() - py;
380
381 if (GetLog()) {
382 if (zmin <= 0 && zmax > 0) zmin = TMath::Min((Double_t)1,
383 (Double_t)0.001 * zmax);
386 Double_t zl = (zmaxl - zminl) * ((Double_t)(y - y1) / (Double_t)(y2 - y1)) + zminl;
387 z = TMath::Power(10., zl);
388 } else {
389 z = (zmax - zmin) * ((Double_t)(y - y1) / (Double_t)(y2 - y1)) + zmin;
390 }
391
392 snprintf(info, 64, "(z=%g)", z);
393 return info;
394}
395
396
397////////////////////////////////////////////////////////////////////////////////
398/// Returns the color index of the given z value
399///
400/// This function should be used after an histogram has been plotted with the
401/// option COL or COLZ like in the following example:
402///
403/// h2->Draw("COLZ");
404/// gPad->Update();
405/// TPaletteAxis *palette = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject("palette");
406/// Int_t ci = palette->GetValueColor(30.);
407///
408/// Then it is possible to retrieve the RGB components in the following way:
409///
410/// TColor *c = gROOT->GetColor(ci);
411/// float x,y,z;
412/// c->GetRGB(x,y,z);
413
415{
416 if (!fH) return 0;
417
422
423 if (GetLog()) {
425 (Double_t)0.001 * wmax);
428 }
429
430 Int_t ncolors = gStyle->GetNumberOfColors();
431 Int_t ndivz =0;
432 if (fH) ndivz = fH->GetContour();
433 if (ndivz == 0) return 0;
435 Int_t theColor, color;
437
439 if (zc < wlmin) zc = wlmin;
440
441 color = Int_t(0.01 + (zc - wlmin) * scale);
442
443 theColor = Int_t((color + 0.99) * Double_t(ncolors) / Double_t(ndivz));
445}
446
447
448////////////////////////////////////////////////////////////////////////////////
449/// Paint the palette.
450
452{
454
455 SetFillStyle(1001);
456 Double_t ymin = fY1;
457 Double_t ymax = fY2;
458 Double_t xmin = fX1;
459 Double_t xmax = fX2;
461 if (fH) {
462 wmin = fH->GetMinimum();
463 wmax = fH->GetMaximum();
464 } else {
465 wmin = fAxis.GetWmin();
466 wmax = fAxis.GetWmax();
467 }
470 Double_t b1, b2, w1, w2, zc;
471 Bool_t kHorizontal = false;
472
473 if ((wlmax - wlmin) <= 0) {
474 Double_t mz = wlmin * 0.1;
475 if (mz == 0) mz = 0.1;
476 wlmin = wlmin - mz;
477 wlmax = wlmax + mz;
478 wmin = wlmin;
479 wmax = wlmax;
480 }
481
482 if (GetX2NDC()-GetX1NDC() > GetY2NDC()-GetY1NDC()) kHorizontal = true;
483
484 if (GetLog()) {
488 }
489 Double_t ws = wlmax - wlmin;
490 Int_t ncolors = gStyle->GetNumberOfColors();
491 Int_t ndivz;
492 if (fH) ndivz = fH->GetContour();
493 else ndivz = ncolors;
494 if (ndivz == 0) return;
496 Int_t theColor, color;
497 // import Attributes already here since we might need them for CJUST
498 if (fH && fH->GetDimension() == 2) {
501 if (ztit.Index(";")>0) {
502 ztit.Remove(ztit.Index(";"),ztit.Length());
503 fAxis.SetTitle(ztit.Data());
504 }
505 }
506 // the 3D histogram's title is stored in Zaxis
507 if (fH && fH->GetDimension() > 2) {
509 fAxis.SetTitle("");
510 if (ztit.Index(";")>0) {
511 ztit.Remove(0,ztit.Index(";")+1);
512 fAxis.SetTitle(ztit.Data());
513 }
514 }
515 // case option "CJUST": put labels directly at color boundaries
516 TLatex *label = nullptr;
517 TLine *line = nullptr;
518 Double_t prevlab = 0;
519 if (fH) {
520 TString opt(fH->GetDrawOption());
521 if (opt.Contains("CJUST", TString::kIgnoreCase)) {
522 label = new TLatex();
525 if (kHorizontal) label->SetTextAlign(kHAlignCenter+kVAlignTop);
527 line = new TLine();
529 if (kHorizontal) line->PaintLine(xmin, ymin, xmax, ymin);
530 else line->PaintLine(xmax, ymin, xmax, ymax);
531 }
532 }
534 Double_t dw = (wlmax - wlmin) / ndivz;
535 for (Int_t i = 0; i < ndivz; i++) {
536
537 if (fH) zc = fH->GetContourLevel(i);
538 else zc = wlmin + i*dw;
539 if (fH && fH->TestBit(TH1::kUserContour) && GetLog())
540 zc = TMath::Log10(zc);
541 w1 = zc;
542 if (w1 < wlmin) w1 = wlmin;
543
544 w2 = wlmax;
545 if (i < ndivz - 1) {
546 if (fH) zc = fH->GetContourLevel(i + 1);
547 else zc = wlmin + (i+1)*dw;
548 if (fH && fH->TestBit(TH1::kUserContour) && GetLog())
549 zc = TMath::Log10(zc);
550 w2 = zc;
551 }
552
553 if (w2 <= wlmin) continue;
554 if (kHorizontal) {
555 b1 = xmin + (w1 - wlmin) * (xmax - xmin) / ws;
556 b2 = xmin + (w2 - wlmin) * (xmax - xmin) / ws;
557 } else {
558 b1 = ymin + (w1 - wlmin) * (ymax - ymin) / ws;
559 b2 = ymin + (w2 - wlmin) * (ymax - ymin) / ws;
560 }
561
562 if (fH && fH->TestBit(TH1::kUserContour)) {
563 color = i;
564 } else {
565 color = Int_t(0.01 + (w1 - wlmin) * scale);
566 }
567
568 theColor = Int_t((color + 0.99) * Double_t(ncolors) / Double_t(ndivz));
571 if (kHorizontal) gPad->PaintBox(b1, ymin, b2, ymax);
572 else gPad->PaintBox(xmin, b1, xmax, b2);
573 // case option "CJUST": put labels directly
574 if (fH && label) {
575 Double_t lof = fAxis.GetLabelOffset()*(gPad->GetUxmax()-gPad->GetUxmin());
576 // the following assumes option "S"
577 Double_t tlength = fAxis.GetTickSize() * (gPad->GetUxmax()-gPad->GetUxmin());
579 Double_t lsize_user = lsize*(gPad->GetUymax()-gPad->GetUymin());
581 if (GetLog()&& !fH->TestBit(TH1::kUserContour)) {
582 zlab = TMath::Power(10, zlab);
583 }
584 // make sure labels dont overlap
585 if (i == 0 || (b1 - prevlab) > 1.5*lsize_user) {
586 if (kHorizontal) label->PaintLatex(b1, ymin - lof, 0, lsize, TString::Format("%g", zlab));
587 else label->PaintLatex(xmax + lof, b1, 0, lsize, TString::Format("%g", zlab));
588 prevlab = b1;
589 }
590 if (kHorizontal) line->PaintLine(b2, ymin+tlength, b2, ymin);
591 else line->PaintLine(xmax-tlength, b1, xmax, b1);
592 if (i == ndivz-1) {
593 // label + tick at top of axis
594 if (fH && (b2 - prevlab > 1.5*lsize_user)) {
595 if (kHorizontal) label->PaintLatex(b2, ymin - lof, 0, lsize, TString::Format("%g",fH->GetMaximum()));
596 else label->PaintLatex(xmax + lof, b2, 0, lsize, TString::Format("%g",fH->GetMaximum()));
597 }
598 if (kHorizontal) line->PaintLine(b1, ymin+tlength, b1, ymin);
599 else line->PaintLine(xmax-tlength, b2, xmax, b2);
600 }
601 }
602 }
603
604 // Take primary divisions only
605 Int_t ndiv;
606 if (fH) ndiv = fH->GetZaxis()->GetNdivisions();
607 else ndiv = fAxis.GetNdiv();
608 Bool_t isOptimized = ndiv>0;
609 Int_t absDiv = abs(ndiv);
610 Int_t maxD = absDiv/1000000;
611 ndiv = absDiv%100 + maxD*1000000;
612 if (!isOptimized) ndiv = -ndiv;
613
614 char chopt[6] = "S ";
615 chopt[1] = 0;
616 strncat(chopt, "+L", 3);
617 if (ndiv < 0) {
618 ndiv = TMath::Abs(ndiv);
619 strncat(chopt, "N", 2);
620 }
621 if (GetLog()) {
622 wmin = TMath::Power(10., wlmin);
623 wmax = TMath::Power(10., wlmax);
624 strncat(chopt, "G", 2);
625 }
626 if (label) {
627 // case option "CJUST", cleanup
628 delete label;
629 delete line;
630 } else {
631 // default
632 if (kHorizontal) fAxis.PaintAxis(xmin, ymin, xmax, ymin, wmin, wmax, ndiv, chopt);
633 else fAxis.PaintAxis(xmax, ymin, xmax, ymax, wmin, wmax, ndiv, chopt);
634 }
635}
636
637
638////////////////////////////////////////////////////////////////////////////////
639/// Save primitive as a C++ statement(s) on output stream out.
640
641void TPaletteAxis::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
642{
643 if (!fH)
644 return;
645
647 out << " palette->SetNdivisions(" << fH->GetZaxis()->GetNdivisions() << ");\n";
648 out << " palette->SetAxisColor(" << TColor::SavePrimitiveColor(fH->GetZaxis()->GetAxisColor()) << ");\n";
649 out << " palette->SetLabelColor(" << TColor::SavePrimitiveColor(fH->GetZaxis()->GetLabelColor()) << ");\n";
650 out << " palette->SetLabelFont(" << fH->GetZaxis()->GetLabelFont() << ");\n";
651 out << " palette->SetLabelOffset(" << fH->GetZaxis()->GetLabelOffset() << ");\n";
652 out << " palette->SetLabelSize(" << fH->GetZaxis()->GetLabelSize() << ");\n";
653 out << " palette->SetMaxDigits(" << fH->GetZaxis()->GetMaxDigits() << ");\n";
654 out << " palette->SetTickLength(" << fH->GetZaxis()->GetTickLength() << ");\n";
655 out << " palette->SetTitleOffset(" << fH->GetZaxis()->GetTitleOffset() << ");\n";
656 out << " palette->SetTitleSize(" << fH->GetZaxis()->GetTitleSize() << ");\n";
657 out << " palette->SetTitleColor(" << TColor::SavePrimitiveColor(fH->GetZaxis()->GetTitleColor()) << ");\n";
658 out << " palette->SetTitleFont(" << fH->GetZaxis()->GetTitleFont() << ");\n";
659 out << " palette->SetTitle(\"" << TString(fH->GetZaxis()->GetTitle()).ReplaceSpecialCppChars() << "\");\n";
660 SaveFillAttributes(out, "palette", -1, -1);
661 SaveLineAttributes(out, "palette", 1, 1, 1);
662}
663
664////////////////////////////////////////////////////////////////////////////////
665/// Unzoom the palette
666
668{
669 if (!fH)
670 return;
671 // if view exists - it will be deleted
672 if (gPad)
673 gPad->SetView(nullptr);
674 fH->GetZaxis()->SetRange(0, 0);
675 if (fH->GetDimension() == 2) {
676 fH->SetMinimum();
677 fH->SetMaximum();
679 }
680}
@ 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:2918
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:573
virtual Int_t GetDimension() const
Definition TH1.h:527
@ kUserContour
User specified contour levels.
Definition TH1.h:404
@ kIsZoomed
Bit set when zooming on Y axis.
Definition TH1.h:407
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:652
virtual void SetMinimum(Double_t minimum=-1111)
Definition TH1.h:653
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:20
virtual void PaintLatex(Double_t x, Double_t y, Double_t angle, Double_t size, const char *text)
Main drawing function.
Definition TLatex.cxx:2102
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.
Int_t fLog
Log option: 0 use Logz, 1 is linear, 2 is log.
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Check if mouse on the axis region.
Int_t GetLog() const
Returns whether the palette is in log scale.
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