ROOT
6.16/01
Reference Guide
tutorials
v7
draw_rh1.cxx
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_v7
3
///
4
/// This macro generates a small V7 TH1D, fills it and draw it in a V7 canvas.
5
/// The canvas is display in the web browser and the corresponding png picture
6
/// is generated.
7
///
8
/// \macro_code
9
///
10
/// \date 2015-03-22
11
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
12
/// \author Axel Naumann <axel@cern.ch>
13
14
/*************************************************************************
15
* Copyright (C) 1995-2015, Rene Brun and Fons Rademakers. *
16
* All rights reserved. *
17
* *
18
* For the licensing terms see $ROOTSYS/LICENSE. *
19
* For the list of contributors see $ROOTSYS/README/CREDITS. *
20
*************************************************************************/
21
22
// R__LOAD_LIBRARY(libROOTGpadv7);
23
24
#include "
ROOT/RHist.hxx
"
25
#include "
ROOT/RCanvas.hxx
"
26
27
void
draw_rh1() {
28
using namespace
ROOT::Experimental
;
29
30
// Create the histogram.
31
RAxisConfig
xaxis(10, 0., 10.);
32
auto
pHist = std::make_shared<RH1D>(xaxis);
33
auto
pHist2 = std::make_shared<RH1D>(xaxis);
34
35
// Fill a few points.
36
pHist->Fill(1);
37
pHist->Fill(2);
38
pHist->Fill(2);
39
pHist->Fill(3);
40
41
pHist2->Fill(5);
42
pHist2->Fill(6);
43
pHist2->Fill(6);
44
pHist2->Fill(7);
45
46
// Create a canvas to be displayed.
47
auto
canvas = RCanvas::Create(
"Canvas Title"
);
48
canvas->Draw(pHist)->SetLineColor(
RColor::kRed
);
49
canvas->Draw(pHist2)->SetLineColor(
RColor::kBlue
);
50
51
canvas->Show();
52
}
RCanvas.hxx
RHist.hxx
kRed
@ kRed
Definition:
Rtypes.h:63
kBlue
@ kBlue
Definition:
Rtypes.h:63
ROOT::Experimental::RAxisConfig
Objects used to configure the different axis types.
Definition:
RAxis.hxx:300
ROOT::Experimental
Definition:
RDrawable.hxx:23