25#include "ROOT/RLegend.hxx"
39 auto pHist = std::make_shared<RH1D>(xaxis);
40 auto pHist2 = std::make_shared<RH1D>(xaxis);
42 for (
int n=0;
n<1000;
n++) {
48 auto canvas = RCanvas::Create(
"RLegend example");
51 canvas->Draw<
RPaletteDrawable>(
RPalette({{0., RColor::kWhite}, {.3, RColor::kRed}, {.7, RColor::kBlue}, {1., RColor::kBlack}}),
false);
54 auto draw1 = canvas->Draw(pHist);
55 draw1->line.width = 2.f;
56 draw1->line.color = .3f;
59 auto draw2 = canvas->Draw(pHist2);
60 draw2->line.width = 4.f;
61 draw2->line.color = .7f;
63 auto legend = canvas->Draw<RLegend>(
"Legend title");
64 legend->fill.color =
RColor(0, 0, 120, 25);
65 legend->fill.style = RAttrFill::k3019;
66 legend->border.color = RColor::kRed;
67 legend->border.width = 2;
68 legend->AddEntry(draw1,
"histo1",
"l");
69 legend->AddEntry(draw2,
"histo2",
"l");
72 auto custom = legend->AddEntry(
"test",
"lfm");
73 custom->line.color = RColor::kGreen;
74 custom->line.width = 5.;
75 custom->line.style = RAttrLine::kSolid;
76 custom->fill.color = RColor::kBlue;
77 custom->fill.style = RAttrFill::k3004;
78 custom->marker.color = RColor::kRed;
79 custom->marker.size = 0.03;
80 custom->marker.style = RAttrMarker::kOpenCross;
82 canvas->SetSize(1000, 700);
#define R__LOAD_LIBRARY(LIBRARY)
R__EXTERN TRandom * gRandom
Objects used to configure the different axis types.
A color palette draw near the frame.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...