21 auto c1 =
new TCanvas(
"c1",
"Drawing inside frame", 1200, 800);
23 if (!
gROOT->IsBatch() && !
c1->IsWeb())
24 ::Warning(
"inframe.cxx",
"macro may not work without enabling web-based canvas");
26 c1->DrawFrame(0., 0., 10., 10.,
"Usage of \"frame\" draw options");
28 auto latex =
new TLatex(3., 8.,
"Text in the frame");
29 latex->SetTextColor(
kCyan);
30 latex->SetTextSize(0.08);
31 latex->SetTextAlign(22);
32 c1->Add(latex,
"frame");
35 auto l1 =
new TLine(-0.5, 5, 10.5, 5);
36 l1->SetLineColor(
kBlue);
39 auto tl1 =
new TLatex(0.5, 5,
"line outside");
40 tl1->SetTextColor(
kBlue);
41 tl1->SetTextAlign(13);
45 auto l2 =
new TLine(-0.5, 5.2, 10.5, 5.2);
49 auto tl2 =
new TLatex(0.5, 5.3,
"line inside");
51 tl2->SetTextAlign(11);
52 c1->Add(tl2,
"frame");
55 auto b1 =
new TBox(-0.5, 1, 4, 3);
56 b1->SetFillColor(
kBlue);
59 auto tb1 =
new TLatex(0.5, 3.1,
"box outside");
60 tb1->SetTextColor(
kBlue);
61 tb1->SetTextAlign(11);
65 auto b2 =
new TBox(6, 1, 10.5, 3);
69 auto b2_dash =
new TBox(6, 1, 10.5, 3);
70 b2_dash->SetFillStyle(0);
71 b2_dash->SetLineColor(
kRed);
73 b2_dash->SetLineWidth(3);
76 auto tb2 =
new TLatex(6.5, 3.1,
"box inside");
78 tb2->SetTextAlign(11);
79 c1->Add(tb2,
"frame");
82 auto m1 =
new TMarker(9.5, 7., 29);
83 m1->SetMarkerColor(
kBlue);
87 auto tm1 =
new TLatex(9.3, 7.,
"outside");
88 tm1->SetTextColor(
kBlue);
89 tm1->SetTextAlign(32);
93 auto m2 =
new TMarker(9.5, 8., 34);
94 m2->SetMarkerColor(
kGreen);
98 auto tm2 =
new TLatex(9.3, 8.,
"inside");
100 tm2->SetTextAlign(32);
101 c1->Add(tm2,
"frame");
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Use the TLine constructor to create a simple line.