Skip to content

Commit 775ebc8

Browse files
authored
[skip-ci] improve TPad::Divide help (#20260)
Improve TPad::Divide help
1 parent 5e2ef44 commit 775ebc8

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

graf2d/gpad/src/TPad.cxx

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,8 +1225,12 @@ Int_t TPad::DistancetoPrimitive(Int_t px, Int_t py)
12251225
/// Automatic pad generation by division.
12261226
///
12271227
/// - The current canvas is divided in nx by ny equal divisions (pads).
1228-
/// - xmargin is the space along x between pads in percent of canvas.
1229-
/// - ymargin is the space along y between pads in percent of canvas.
1228+
/// - xmargin defines the horizontal spacing around each pad as a percentage of the canvas
1229+
/// width. Therefore, the distance between two adjacent pads along the x-axis is equal
1230+
/// to twice the xmargin value.
1231+
/// - ymargin defines the vertical spacing around each pad as a percentage of the canvas
1232+
/// height. Therefore, the distance between two adjacent pads along the y-axis is equal
1233+
/// to twice the ymargin value.
12301234
/// - color is the color of the new pads. If 0, color is the canvas color.
12311235
///
12321236
/// Pads are automatically named `canvasname_n` where `n` is the division number
@@ -1253,7 +1257,32 @@ Int_t TPad::DistancetoPrimitive(Int_t px, Int_t py)
12531257
///
12541258
/// __Note3:__ in case xmargin < 0 or ymargin < 0, there is no space
12551259
/// between pads. The current pad margins are recomputed to
1256-
/// optimize the layout.
1260+
/// optimize the layout in order to have similar frames' areas.
1261+
/// See the following example:
1262+
///
1263+
/// ~~~ {.cpp}
1264+
/// void divpad(Int_t nx=3, Int_t ny=2) {
1265+
/// gStyle->SetOptStat(0);
1266+
/// auto C = new TCanvas();
1267+
/// C->SetMargin(0.3, 0.3, 0.3, 0.3);
1268+
/// C->Divide(nx,ny,-1);
1269+
/// Int_t number = 0;
1270+
/// auto h = new TH1F("","",100,-3.3,3.3);
1271+
/// h->GetXaxis()->SetLabelFont(43);
1272+
/// h->GetXaxis()->SetLabelSize(12);
1273+
/// h->GetYaxis()->SetLabelFont(43);
1274+
/// h->GetYaxis()->SetLabelSize(12);
1275+
/// h->GetYaxis()->SetNdivisions(505);
1276+
/// h->SetMaximum(30*nx*ny);
1277+
/// h->SetFillColor(42);
1278+
/// for (Int_t i=0;i<nx*ny;i++) {
1279+
/// number++;
1280+
/// C->cd(number);
1281+
/// h->FillRandom("gaus",1000);
1282+
/// h->DrawCopy();
1283+
/// }
1284+
/// }
1285+
/// ~~~
12571286

12581287
void TPad::Divide(Int_t nx, Int_t ny, Float_t xmargin, Float_t ymargin, Int_t color)
12591288
{
@@ -4492,7 +4521,7 @@ void TPad::PaintLine3D(Float_t *p1, Float_t *p2)
44924521
void TPad::PaintLine3D(Double_t *p1, Double_t *p2)
44934522
{
44944523
if (!fView) return;
4495-
4524+
44964525
// convert from 3-D to 2-D pad coordinate system
44974526
Double_t xpad[6];
44984527
Double_t temp[3];
@@ -4510,7 +4539,7 @@ void TPad::PaintLine3D(Double_t *p1, Double_t *p2)
45104539
void TPad::PaintMarker3D(Double_t x, Double_t y, Double_t z)
45114540
{
45124541
if (!fView) return;
4513-
4542+
45144543
Double_t rmin[3], rmax[3];
45154544
fView->GetRange(rmin, rmax);
45164545

0 commit comments

Comments
 (0)