I made an example:
using namespace RooFit;
void roofit_legend()
{
RooRealVar dt("dt", "dt", -20, 20);
RooRealVar dm("dm", "dm", 0.472);
RooRealVar tau("tau", "tau", 1.547);
RooRealVar w("w", "mistag rate", 0.1);
RooRealVar dw("dw", "delta mistag rate", 0.);
RooCategory mixState("mixState", "B0/B0bar mixing state");
mixState.defineType("mixed", -1);
mixState.defineType("unmixed", 1);
RooCategory tagFlav("tagFlav", "Flavour of the tagged B0");
tagFlav.defineType("B0", 1);
tagFlav.defineType("B0bar", -1);
RooRealVar bias1("bias1", "bias1", 0);
RooRealVar sigma1("sigma1", "sigma1", 0.1);
RooGaussModel gm1("gm1", "gauss model 1", dt, bias1, sigma1);
RooBMixDecay bmix("bmix", "decay", dt, mixState, tagFlav, tau, dm, w, dw, gm1, RooBMixDecay::DoubleSided);
RooDataSet *data = bmix.generate(RooArgSet(dt, mixState, tagFlav), 2000);
RooBinning abins(-10, 10);
abins.addBoundary(0);
abins.addBoundaryPair(1);
abins.addBoundaryPair(2);
abins.addBoundaryPair(3);
abins.addBoundaryPair(4);
abins.addBoundaryPair(6);
// Create plot frame in dt
RooPlot *aframe = dt.frame(Range(-10, 10));
data->plotOn(aframe, Name("data1"), Asymmetry(mixState), Binning(abins));
// Draw plots on canvas
TCanvas *c = new TCanvas("rf108_plotbinning", "rf108_plotbinning", 400, 400);
aframe->Draw();
// Draw legend
TLegend *leg = new TLegend(0.55,0.65,0.89,0.89);
leg->AddEntry("data1", "This is data1", "p");
leg->Draw();
}