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");
29 auto latex =
new TLatex(3., 8.,
"Text in the frame");
30 latex->SetTextColor(
kCyan);
31 latex->SetTextSize(0.08);
32 latex->SetTextAlign(22);
33 c1->Add(latex,
"frame");
36 auto l1 =
new TLine(-0.5, 5, 10.5, 5);
37 l1->SetLineColor(
kBlue);
40 auto tl1 =
new TLatex(0.5, 5,
"line outside");
41 tl1->SetTextColor(
kBlue);
42 tl1->SetTextAlign(13);
46 auto l2 =
new TLine(-0.5, 5.2, 10.5, 5.2);
50 auto tl2 =
new TLatex(0.5, 5.3,
"line inside");
52 tl2->SetTextAlign(11);
53 c1->Add(tl2,
"frame");
56 auto b1 =
new TBox(-0.5, 1, 4, 3);
57 b1->SetFillColor(
kBlue);
60 auto tb1 =
new TLatex(0.5, 3.1,
"box outside");
61 tb1->SetTextColor(
kBlue);
62 tb1->SetTextAlign(11);
66 auto b2 =
new TBox(6, 1, 10.5, 3);
70 auto b2_dash =
new TBox(6, 1, 10.5, 3);
71 b2_dash->SetFillStyle(0);
72 b2_dash->SetLineColor(
kRed);
74 b2_dash->SetLineWidth(3);
77 auto tb2 =
new TLatex(6.5, 3.1,
"box inside");
79 tb2->SetTextAlign(11);
80 c1->Add(tb2,
"frame");
83 auto m1 =
new TMarker(9.5, 7., 29);
84 m1->SetMarkerColor(
kBlue);
88 auto tm1 =
new TLatex(9.3, 7.,
"outside");
89 tm1->SetTextColor(
kBlue);
90 tm1->SetTextAlign(32);
94 auto m2 =
new TMarker(9.5, 8., 34);
95 m2->SetMarkerColor(
kGreen);
99 auto tm2 =
new TLatex(9.3, 8.,
"inside");
100 tm2->SetTextColor(
kGreen);
101 tm2->SetTextAlign(32);
102 c1->Add(tm2,
"frame");
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
To draw Mathematical Formula.
Use the TLine constructor to create a simple line.