Logo ROOT  
Reference Guide
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
27
28
29////////////////////////////////////////////////////////////////////////////////
30
31/*! \class TPaletteAxis
32 \ingroup Histpainter
33 \brief The palette painting class.
34
35A `TPaletteAxis` object is used to display the color palette when
36drawing 2-d histograms.
37
38The `TPaletteAxis` is automatically created drawn when drawing a 2-D
39histogram when the option "Z" is specified.
40
41A `TPaletteAxis` object is added to the histogram list of functions and
42can be retrieved doing:
43
44 TPaletteAxis *palette = (TPaletteAxis*)h->GetListOfFunctions()->FindObject("palette");
45
46then the pointer `palette` can be used to change the palette attributes.
47
48Because the palette is created at painting time only, one must issue a:
49
50 gPad->Update();
51
52before retrieving the palette pointer in order to create the palette. The following
53macro gives an example.
54
55Begin_Macro(source)
56{
57 TCanvas *c1 = new TCanvas("c1","c1",600,400);
58 TH2F *h2 = new TH2F("h2","Example of a resized palette ",40,-4,4,40,-20,20);
59 Float_t px, py;
60 for (Int_t i = 0; i < 25000; i++) {
61 gRandom->Rannor(px,py);
62 h2->Fill(px,5*py);
63 }
64 gStyle->SetPalette(1);
65 h2->Draw("COLZ");
66 gPad->Update();
67 TPaletteAxis *palette = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject("palette");
68 palette->SetY2NDC(0.7);
69 return c1;
70}
71End_Macro
72
73`TPaletteAxis` inherits from `TBox` and `TPave`. The methods
74allowing to specify the palette position are inherited from these two classes.
75
76The palette can be interactively moved and resized. The context menu
77can be used to set the axis attributes.
78
79It is possible to select a range on the axis to set the min/max in z
80
81As default labels and ticks are drawn by `TGAxis` at equidistant (lin or log)
82points as controlled by SetNdivisions.
83If option "CJUST" is given labels and ticks are justified at the
84color boundaries defined by the contour levels.
85In this case no optimization can be done. It is responsibility of the
86user to adjust minimum, maximum of the histogram and/or the contour levels
87to get a reasonable look of the plot.
88Only overlap of the labels is avoided if too many contour levels are used.
89
90This option is especially useful with user defined contours.
91An example is shown here:
92
93Begin_Macro(source)
94{
95 gStyle->SetOptStat(0);
96 TCanvas *c1 = new TCanvas("c1","exa_CJUST",300,10,400,400);
97 TH2F *hpxpy = new TH2F("hpxpy","py vs px",40,-4,4,40,-4,4);
98 // Fill histograms randomly
99 TRandom3 randomNum;
100 Float_t px, py;
101 for (Int_t i = 0; i < 25000; i++) {
102 randomNum.Rannor(px,py);
103 hpxpy->Fill(px,py);
104 }
105 hpxpy->SetMaximum(200);
106 Double_t zcontours[5] = {0, 20, 40, 80, 120};
107 hpxpy->SetContour(5, zcontours);
108 hpxpy->GetZaxis()->SetTickSize(0.01);
109 hpxpy->GetZaxis()->SetLabelOffset(0.01);
110 gPad->SetRightMargin(0.13);
111 hpxpy->SetTitle("User contours, CJUST");
112 hpxpy->Draw("COL Z CJUST");
113}
114End_Macro
115*/
116
117
118////////////////////////////////////////////////////////////////////////////////
119/// Palette default constructor.
120
122{
123 fH = nullptr;
124 SetName("");
125}
126
127
128////////////////////////////////////////////////////////////////////////////////
129/// Palette normal constructor.
130
132 : TPave(x1, y1, x2, y2)
133{
134 fH = h;
135 SetName("palette");
136 TAxis *zaxis = fH->GetZaxis();
138 if (gPad->GetView()) SetBit(kHasView);
139}
140
141
142////////////////////////////////////////////////////////////////////////////////
143/// Palette destructor.
144
146{
147}
148
149
150////////////////////////////////////////////////////////////////////////////////
151/// Palette copy constructor.
152
154{
155 palette.TPaletteAxis::Copy(*this);
156}
157
158
159////////////////////////////////////////////////////////////////////////////////
160/// Assignment operator.
161
163{
164 if (this != &orig)
165 orig.TPaletteAxis::Copy(*this);
166 return *this;
167}
168
169
170////////////////////////////////////////////////////////////////////////////////
171/// Copy a palette to a palette.
172
174{
175 TPave::Copy(obj);
176 ((TPaletteAxis&)obj).fH = fH;
177}
178
179
180////////////////////////////////////////////////////////////////////////////////
181/// Check if mouse on the axis region.
182
184{
185 Int_t plxmax = gPad->XtoAbsPixel(fX2);
186 Int_t plymin = gPad->YtoAbsPixel(fY1);
187 Int_t plymax = gPad->YtoAbsPixel(fY2);
188 if (px > plxmax && px < plxmax + 30 && py >= plymax && py <= plymin) return px - plxmax;
189
190 //otherwise check if inside the box
191 return TPave::DistancetoPrimitive(px, py);
192}
193
194
195////////////////////////////////////////////////////////////////////////////////
196/// Check if mouse on the axis region.
197
199{
200 if (!gPad) return;
201
202 static Int_t kmode = 0;
203 Int_t plxmin = gPad->XtoAbsPixel(fX1);
204 Int_t plxmax = gPad->XtoAbsPixel(fX2);
205 if (kmode != 0 || px <= plxmax) {
206 if (event == kButton1Down) kmode = 1;
207 TBox::ExecuteEvent(event, px, py);
208 if (event == kButton1Up) kmode = 0;
209 // In case palette coordinates have been modified, recompute NDC coordinates
210 Double_t dpx = gPad->GetX2() - gPad->GetX1();
211 Double_t dpy = gPad->GetY2() - gPad->GetY1();
212 Double_t xp1 = gPad->GetX1();
213 Double_t yp1 = gPad->GetY1();
214 fX1NDC = (fX1 - xp1) / dpx;
215 fY1NDC = (fY1 - yp1) / dpy;
216 fX2NDC = (fX2 - xp1) / dpx;
217 fY2NDC = (fY2 - yp1) / dpy;
218 return;
219 }
220 gPad->SetCursor(kHand);
221 static Double_t ratio1, ratio2;
222 static Int_t px1old, py1old, px2old, py2old;
223 Double_t temp, xmin, xmax;
224
225 switch (event) {
226
227 case kButton1Down:
228 ratio1 = (gPad->AbsPixeltoY(py) - fY1) / (fY2 - fY1);
229 py1old = gPad->YtoAbsPixel(fY1 + ratio1 * (fY2 - fY1));
230 px1old = plxmin;
231 px2old = plxmax;
232 py2old = py1old;
233 gVirtualX->DrawBox(px1old, py1old, px2old, py2old, TVirtualX::kHollow);
234 gVirtualX->SetLineColor(-1);
235 // No break !!!
236
237 case kButton1Motion:
238 gVirtualX->DrawBox(px1old, py1old, px2old, py2old, TVirtualX::kHollow);
239 ratio2 = (gPad->AbsPixeltoY(py) - fY1) / (fY2 - fY1);
240 py2old = gPad->YtoAbsPixel(fY1 + ratio2 * (fY2 - fY1));
241 gVirtualX->DrawBox(px1old, py1old, px2old, py2old, TVirtualX::kHollow);
242 break;
243
244 case kButton1Up:
245 if (gROOT->IsEscaped()) {
246 gROOT->SetEscape(kFALSE);
247 break;
248 }
249
250 ratio2 = (gPad->AbsPixeltoY(py) - fY1) / (fY2 - fY1);
251 xmin = ratio1;
252 xmax = ratio2;
253 if (xmin > xmax) {
254 temp = xmin;
255 xmin = xmax;
256 xmax = temp;
257 temp = ratio1;
258 ratio1 = ratio2;
259 ratio2 = temp;
260 }
261 if (ratio2 - ratio1 > 0.05) {
262 if (fH->GetDimension() == 2) {
263 Double_t zmin = fH->GetMinimum();
264 Double_t zmax = fH->GetMaximum();
265 if (gPad->GetLogz()) {
266 if (zmin <= 0 && zmax > 0) zmin = TMath::Min((Double_t)1,
267 (Double_t)0.001 * zmax);
268 zmin = TMath::Log10(zmin);
269 zmax = TMath::Log10(zmax);
270 }
271 Double_t newmin = zmin + (zmax - zmin) * ratio1;
272 Double_t newmax = zmin + (zmax - zmin) * ratio2;
273 if (newmin < zmin)newmin = fH->GetBinContent(fH->GetMinimumBin());
274 if (newmax > zmax)newmax = fH->GetBinContent(fH->GetMaximumBin());
275 if (gPad->GetLogz()) {
276 newmin = TMath::Exp(2.302585092994 * newmin);
277 newmax = TMath::Exp(2.302585092994 * newmax);
278 }
279 fH->SetMinimum(newmin);
280 fH->SetMaximum(newmax);
282 }
283 gPad->Modified(kTRUE);
284 }
285 gVirtualX->SetLineColor(-1);
286 kmode = 0;
287 break;
288 }
289}
290
291
292////////////////////////////////////////////////////////////////////////////////
293/// Returns the color index of the bin (i,j).
294///
295/// This function should be used after an histogram has been plotted with the
296/// option COL or COLZ like in the following example:
297///
298/// h2->Draw("COLZ");
299/// gPad->Update();
300/// TPaletteAxis *palette = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject("palette");
301/// Int_t ci = palette->GetBinColor(20,15);
302///
303/// Then it is possible to retrieve the RGB components in the following way:
304///
305/// TColor *c = gROOT->GetColor(ci);
306/// float x,y,z;
307/// c->GetRGB(x,y,z);
308
310{
311 Double_t zc = fH->GetBinContent(i, j);
312 return GetValueColor(zc);
313}
314
315
316////////////////////////////////////////////////////////////////////////////////
317/// Displays the z value corresponding to cursor position py.
318
319char *TPaletteAxis::GetObjectInfo(Int_t /* px */, Int_t py) const
320{
321 Double_t z;
322 static char info[64];
323
324 Double_t zmin = fH->GetMinimum();
325 Double_t zmax = fH->GetMaximum();
326 Int_t y1 = gPad->GetWh() - gPad->VtoPixel(fY1NDC);
327 Int_t y2 = gPad->GetWh() - gPad->VtoPixel(fY2NDC);
328 Int_t y = gPad->GetWh() - py;
329
330 if (gPad->GetLogz()) {
331 if (zmin <= 0 && zmax > 0) zmin = TMath::Min((Double_t)1,
332 (Double_t)0.001 * zmax);
333 Double_t zminl = TMath::Log10(zmin);
334 Double_t zmaxl = TMath::Log10(zmax);
335 Double_t zl = (zmaxl - zminl) * ((Double_t)(y - y1) / (Double_t)(y2 - y1)) + zminl;
336 z = TMath::Power(10., zl);
337 } else {
338 z = (zmax - zmin) * ((Double_t)(y - y1) / (Double_t)(y2 - y1)) + zmin;
339 }
340
341 snprintf(info, 64, "(z=%g)", z);
342 return info;
343}
344
345
346////////////////////////////////////////////////////////////////////////////////
347/// Returns the color index of the given z value
348///
349/// This function should be used after an histogram has been plotted with the
350/// option COL or COLZ like in the following example:
351///
352/// h2->Draw("COLZ");
353/// gPad->Update();
354/// TPaletteAxis *palette = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject("palette");
355/// Int_t ci = palette->GetValueColor(30.);
356///
357/// Then it is possible to retrieve the RGB components in the following way:
358///
359/// TColor *c = gROOT->GetColor(ci);
360/// float x,y,z;
361/// c->GetRGB(x,y,z);
362
364{
367 Double_t wlmin = wmin;
368 Double_t wlmax = wmax;
369
370 if (gPad->GetLogz()) {
371 if (wmin <= 0 && wmax > 0) wmin = TMath::Min((Double_t)1,
372 (Double_t)0.001 * wmax);
373 wlmin = TMath::Log10(wmin);
374 wlmax = TMath::Log10(wmax);
375 }
376
377 Int_t ncolors = gStyle->GetNumberOfColors();
378 Int_t ndivz = fH->GetContour();
379 if (ndivz == 0) return 0;
380 ndivz = TMath::Abs(ndivz);
381 Int_t theColor, color;
382 Double_t scale = ndivz / (wlmax - wlmin);
383
384 if (fH->TestBit(TH1::kUserContour) && gPad->GetLogz()) zc = TMath::Log10(zc);
385 if (zc < wlmin) zc = wlmin;
386
387 color = Int_t(0.01 + (zc - wlmin) * scale);
388
389 theColor = Int_t((color + 0.99) * Double_t(ncolors) / Double_t(ndivz));
390 return gStyle->GetColorPalette(theColor);
391}
392
393
394////////////////////////////////////////////////////////////////////////////////
395/// Paint the palette.
396
398{
400
401 SetFillStyle(1001);
402 Double_t ymin = fY1;
403 Double_t ymax = fY2;
404 Double_t xmin = fX1;
405 Double_t xmax = fX2;
408 Double_t wlmin = wmin;
409 Double_t wlmax = wmax;
410 Double_t b1, b2, w1, w2, zc;
411 Bool_t kHorizontal = false;
412
413 if ((wlmax - wlmin) <= 0) {
414 Double_t mz = wlmin * 0.1;
415 if (mz == 0) mz = 0.1;
416 wlmin = wlmin - mz;
417 wlmax = wlmax + mz;
418 wmin = wlmin;
419 wmax = wlmax;
420 }
421
422 if (GetX2NDC()-GetX1NDC() > GetY2NDC()-GetY1NDC()) kHorizontal = true;
423
424 if (gPad->GetLogz()) {
425 if (wmin <= 0 && wmax > 0) wmin = TMath::Min((Double_t)1, (Double_t)0.001 * wmax);
426 wlmin = TMath::Log10(wmin);
427 wlmax = TMath::Log10(wmax);
428 }
429 Double_t ws = wlmax - wlmin;
430 Int_t ncolors = gStyle->GetNumberOfColors();
431 Int_t ndivz = fH->GetContour();
432 if (ndivz == 0) return;
433 ndivz = TMath::Abs(ndivz);
434 Int_t theColor, color;
435 // import Attributes already here since we might need them for CJUST
437 // case option "CJUST": put labels directly at color boundaries
438 TLatex *label = nullptr;
439 TLine *line = nullptr;
440 Double_t prevlab = 0;
441 TString opt(fH->GetDrawOption());
442 if (opt.Contains("CJUST", TString::kIgnoreCase)) {
443 label = new TLatex();
446 if (kHorizontal) label->SetTextAlign(kHAlignCenter+kVAlignTop);
448 line = new TLine();
450 if (kHorizontal) line->PaintLine(xmin, ymin, xmax, ymin);
451 else line->PaintLine(xmax, ymin, xmax, ymax);
452 }
453 Double_t scale = ndivz / (wlmax - wlmin);
454 for (Int_t i = 0; i < ndivz; i++) {
455
456 zc = fH->GetContourLevel(i);
457 if (fH->TestBit(TH1::kUserContour) && gPad->GetLogz())
458 zc = TMath::Log10(zc);
459 w1 = zc;
460 if (w1 < wlmin) w1 = wlmin;
461
462 w2 = wlmax;
463 if (i < ndivz - 1) {
464 zc = fH->GetContourLevel(i + 1);
465 if (fH->TestBit(TH1::kUserContour) && gPad->GetLogz())
466 zc = TMath::Log10(zc);
467 w2 = zc;
468 }
469
470 if (w2 <= wlmin) continue;
471 if (kHorizontal) {
472 b1 = xmin + (w1 - wlmin) * (xmax - xmin) / ws;
473 b2 = xmin + (w2 - wlmin) * (xmax - xmin) / ws;
474 } else {
475 b1 = ymin + (w1 - wlmin) * (ymax - ymin) / ws;
476 b2 = ymin + (w2 - wlmin) * (ymax - ymin) / ws;
477 }
478
480 color = i;
481 } else {
482 color = Int_t(0.01 + (w1 - wlmin) * scale);
483 }
484
485 theColor = Int_t((color + 0.99) * Double_t(ncolors) / Double_t(ndivz));
488 if (kHorizontal) gPad->PaintBox(b1, ymin, b2, ymax);
489 else gPad->PaintBox(xmin, b1, xmax, b2);
490 // case option "CJUST": put labels directly
491 if (label) {
492 Double_t lof = fAxis.GetLabelOffset()*(gPad->GetUxmax()-gPad->GetUxmin());
493 // the following assumes option "S"
494 Double_t tlength = fAxis.GetTickSize() * (gPad->GetUxmax()-gPad->GetUxmin());
495 Double_t lsize = fAxis.GetLabelSize();
496 Double_t lsize_user = lsize*(gPad->GetUymax()-gPad->GetUymin());
497 Double_t zlab = fH->GetContourLevel(i);
498 if (gPad->GetLogz()&& !fH->TestBit(TH1::kUserContour)) {
499 zlab = TMath::Power(10, zlab);
500 }
501 // make sure labels dont overlap
502 if (i == 0 || (b1 - prevlab) > 1.5*lsize_user) {
503 if (kHorizontal) label->PaintLatex(b1, ymin - lof, 0, lsize, Form("%g", zlab));
504 else label->PaintLatex(xmax + lof, b1, 0, lsize, Form("%g", zlab));
505 prevlab = b1;
506 }
507 if (kHorizontal) line->PaintLine(b2, ymin+tlength, b2, ymin);
508 else line->PaintLine(xmax-tlength, b1, xmax, b1);
509 if (i == ndivz-1) {
510 // label + tick at top of axis
511 if ((b2 - prevlab > 1.5*lsize_user)) {
512 if (kHorizontal) label->PaintLatex(b2, ymin - lof, 0, lsize, Form("%g",fH->GetMaximum()));
513 else label->PaintLatex(xmax + lof, b2, 0, lsize, Form("%g",fH->GetMaximum()));
514 }
515 if (kHorizontal) line->PaintLine(b1, ymin+tlength, b1, ymin);
516 else line->PaintLine(xmax-tlength, b2, xmax, b2);
517 }
518 }
519 }
520
521 // Take primary divisions only
522 Int_t ndiv = fH->GetZaxis()->GetNdivisions();
523 Bool_t isOptimized = ndiv>0;
524 Int_t absDiv = abs(ndiv);
525 Int_t maxD = absDiv/1000000;
526 ndiv = absDiv%100 + maxD*1000000;
527 if (!isOptimized) ndiv = -ndiv;
528
529 char chopt[6] = "S ";
530 chopt[1] = 0;
531 strncat(chopt, "+L", 3);
532 if (ndiv < 0) {
533 ndiv = TMath::Abs(ndiv);
534 strncat(chopt, "N", 2);
535 }
536 if (gPad->GetLogz()) {
537 wmin = TMath::Power(10., wlmin);
538 wmax = TMath::Power(10., wlmax);
539 strncat(chopt, "G", 2);
540 }
541 if (label) {
542 // case option "CJUST", cleanup
543 delete label;
544 delete line;
545 } else {
546 // default
547 if (kHorizontal) fAxis.PaintAxis(xmin, ymin, xmax, ymin, wmin, wmax, ndiv, chopt);
548 else fAxis.PaintAxis(xmax, ymin, xmax, ymax, wmin, wmax, ndiv, chopt);
549 }
550}
551
552
553////////////////////////////////////////////////////////////////////////////////
554/// Save primitive as a C++ statement(s) on output stream out.
555
556void TPaletteAxis::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
557{
558 //char quote = '"';
559 out << " " << std::endl;
560 if (gROOT->ClassSaved(TPaletteAxis::Class())) {
561 out << " ";
562 } else {
563 out << " " << ClassName() << " *";
564 }
565 if (fOption.Contains("NDC")) {
566 out << "palette = new " << ClassName() << "(" << fX1NDC << "," << fY1NDC << "," << fX2NDC << "," << fY2NDC
567 << "," << fH->GetName() << ");" << std::endl;
568 } else {
569 out << "palette = new " << ClassName() << "(" << fX1 << "," << fY1 << "," << fX2 << "," << fY2
570 << "," << fH->GetName() << ");" << std::endl;
571 }
572 out << " palette->SetLabelColor(" << fAxis.GetLabelColor() << ");" << std::endl;
573 out << " palette->SetLabelFont(" << fAxis.GetLabelFont() << ");" << std::endl;
574 out << " palette->SetLabelOffset(" << fAxis.GetLabelOffset() << ");" << std::endl;
575 out << " palette->SetLabelSize(" << fAxis.GetLabelSize() << ");" << std::endl;
576 out << " palette->SetTitleOffset(" << fAxis.GetTitleOffset() << ");" << std::endl;
577 out << " palette->SetTitleSize(" << fAxis.GetTitleSize() << ");" << std::endl;
578 SaveFillAttributes(out, "palette", -1, -1);
579 SaveLineAttributes(out, "palette", 1, 1, 1);
580}
581
582
583////////////////////////////////////////////////////////////////////////////////
584/// Unzoom the palette
585
587{
588 TView *view = gPad ? gPad->GetView() : nullptr;
589 if (view) {
590 delete view;
591 gPad->SetView(nullptr);
592 }
593 fH->GetZaxis()->SetRange(0, 0);
594 if (fH->GetDimension() == 2) {
595 fH->SetMinimum();
596 fH->SetMaximum();
598 }
599}
@ 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
Definition: RtypesCore.h:45
const Bool_t kFALSE
Definition: RtypesCore.h:101
double Double_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassImp(name)
Definition: Rtypes.h:375
@ kVAlignTop
Definition: TAttText.h:54
@ kVAlignCenter
Definition: TAttText.h:54
@ kHAlignLeft
Definition: TAttText.h:53
@ kHAlignCenter
Definition: TAttText.h:53
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 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
Definition: THbookFile.cxx:95
float ymin
Definition: THbookFile.cxx:95
float xmax
Definition: THbookFile.cxx:95
float ymax
Definition: THbookFile.cxx:95
#define gROOT
Definition: TROOT.h:404
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition: TString.cxx:2452
R__EXTERN TStyle * gStyle
Definition: TStyle.h:414
#define gPad
Definition: TVirtualPad.h:288
#define gVirtualX
Definition: TVirtualX.h:338
#define snprintf
Definition: civetweb.c:1540
virtual Int_t GetNdivisions() const
Definition: TAttAxis.h:36
virtual void Modify()
Change current fill area attributes if necessary.
Definition: TAttFill.cxx:213
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition: TAttFill.h:39
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:236
virtual Color_t GetLineColor() const
Return the line color.
Definition: TAttLine.h:33
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
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:273
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition: TAttText.h:42
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition: TAttText.h:44
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition: TAttText.h:46
Class to manage histogram axis.
Definition: TAxis.h:30
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis using bin numbers.
Definition: TAxis.cxx:952
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
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:1009
Float_t GetLabelOffset() const
Definition: TGaxis.h:83
virtual void ImportAxisAttributes(TAxis *axis)
Internal method to import TAxis attributes to this TGaxis.
Definition: TGaxis.cxx:957
Int_t GetLabelFont() const
Definition: TGaxis.h:82
Float_t GetTitleOffset() const
Definition: TGaxis.h:85
Float_t GetTitleSize() const
Definition: TGaxis.h:86
Int_t GetLabelColor() const
Definition: TGaxis.h:81
Float_t GetTickSize() const
Definition: TGaxis.h:94
Float_t GetLabelSize() const
Definition: TGaxis.h:84
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
TAxis * GetZaxis()
Definition: TH1.h:321
virtual Int_t GetDimension() const
Definition: TH1.h:281
@ kUserContour
User specified contour levels.
Definition: TH1.h:164
@ kIsZoomed
Bit set when zooming on Y axis.
Definition: TH1.h:167
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:8412
virtual void SetMaximum(Double_t maximum=-1111)
Definition: TH1.h:397
virtual void SetMinimum(Double_t minimum=-1111)
Definition: TH1.h:398
virtual Int_t GetMaximumBin() const
Return location of bin with maximum value in the range.
Definition: TH1.cxx:8444
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition: TH1.cxx:5025
virtual Int_t GetContour(Double_t *levels=nullptr)
Return contour values into array levels if pointer levels is non zero.
Definition: TH1.cxx:8278
virtual Double_t GetContourLevel(Int_t level) const
Return value of contour number level.
Definition: TH1.cxx:8297
virtual Int_t GetMinimumBin() const
Return location of bin with minimum value in the range.
Definition: TH1.cxx:8532
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:8502
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:2053
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:397
const char * GetName() const override
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:187
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:130
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
Definition: TObject.cxx:347
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:698
void ResetBit(UInt_t f)
Definition: TObject.h:186
The palette painting class.
Definition: TPaletteAxis.h:29
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.
Definition: TPaletteAxis.h:32
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
Definition: TPaletteAxis.h:33
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:62
virtual void ConvertNDCtoPad()
Convert pave coordinates from NDC to Pad coordinates.
Definition: TPave.cxx:139
Double_t GetX2NDC() const
Definition: TPave.h:60
void Copy(TObject &pave) const override
Copy this pave to pave.
Definition: TPave.cxx:186
virtual void SetName(const char *name="")
Definition: TPave.h:75
Double_t fX2NDC
X2 point in NDC coordinates.
Definition: TPave.h:24
Double_t GetY1NDC() const
Definition: TPave.h:61
TString fOption
Pave style.
Definition: TPave.h:30
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:208
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:59
Basic string class.
Definition: TString.h:136
@ kIgnoreCase
Definition: TString.h:268
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:624
Int_t GetColorPalette(Int_t i) const
Return color number i in current palette.
Definition: TStyle.cxx:1057
Int_t GetNumberOfColors() const
Return number of colors in the color palette.
Definition: TStyle.cxx:1123
See TView3D.
Definition: TView.h:25
TLine * line
RVec< PromoteType< T > > abs(const RVec< T > &v)
Definition: RVec.hxx:1756
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:707
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Definition: TMath.h:719
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition: TMathBase.h:198
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Definition: TMath.h:760
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition: TMathBase.h:123