Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
rpad.cxx
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_rcanvas
3///
4/// This ROOT 7 example demonstrates how to create a ROOT 7 canvas (RCanvas) and
5/// and divide it in 9 sub-pads.
6///
7/// \macro_image (rcanvas_js)
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
12/// is welcome!
13/// \author Axel Naumann <axel@cern.ch>
14
15/*************************************************************************
16 * Copyright (C) 1995-2015, Rene Brun and Fons Rademakers. *
17 * All rights reserved. *
18 * *
19 * For the licensing terms see $ROOTSYS/LICENSE. *
20 * For the list of contributors see $ROOTSYS/README/CREDITS. *
21 *************************************************************************/
22
23#include "ROOT/RCanvas.hxx"
24#include "ROOT/RPad.hxx"
25#include "ROOT/RLine.hxx"
26
27void rpad()
28{
29 using namespace ROOT::Experimental;
30
31 auto canvas = RCanvas::Create("RCanvas::Divide example");
32 auto pads = canvas->Divide(3, 3);
33
34 for (int i = 0; i < 3; ++i)
35 for (int j = 0; j < 3; ++j) {
36 pads[i][j]->Draw<RLine>()->SetP1({0.1_normal, 0.1_normal}).SetP2({0.9_normal, 0.9_normal});
37 pads[i][j]->Draw<RLine>()->SetP1({0.1_normal, 0.9_normal}).SetP2({0.9_normal, 0.1_normal});
38 }
39
40 canvas->Show();
41}