auto legend = new TLegend(0.7, 0.7, 0.9, 0.9); // create a new legend legend->SetBorderSize(2); // set border size to 2
auto graph = new TGraph(); // create a new graph graph->SetTitle("My Graph"); // set graph title auto legend = new TLegend(0.7, 0.7, 0.9, 0.9); // create a new legend legend->AddEntry(graph, "My Graph", "l"); // add graph to legend legend->SetBorderSize(3); // set border size to 3This code creates a new graph and legend, adds the graph to the legend, sets the legend's border size to 3, and specifies that the graph in the legend should have a solid line. The examples above were written using C++ programming language and ROOT package library.