I’m attempting to plot multiple TGraphErrors on a single plot. I am able to do this. I then am trying to build a legend. Again, I am successful, to a certain extent. I will attach the plot I am getting as an image, and dislay at bottom of post.
The problem is, when I attempt to draw the legend, both labels show up, however they both show a generic “square” and “black” point or line, depending on what option I choose. If I try to use a gr->SetFillColor(2), then ask it to show the “Fill” option, it just draws a box that is tranparent to the Legend Fill Color. Thus, I’m unable to use the legend to distinguish the different data sets. My ROOT version is 5.34.09 (built from source today), on Ubuntu 13.1 (x86_64).
Here is the relevant part of my code:
/// Invoke Canvas, Draw Frame, Set Titles, etc
TCanvas *c1 = new TCanvas(“c1”,“Graph Title”,200,10,700,500);
TH1F *hr = c1->DrawFrame(95,0,305,2.5);
hr->SetXTitle(“Incoming Neutron Energy (MeV)”);
hr->SetTitle(“U-238 n,Fiss Cross-Section”);
/// Define Data Sets into plottable functions, set draw options
TGraphErrors *grK = new TGraphErrors(j-1,xK,yK,dxK,dyK);
TGraphErrors *gr = new TGraphErrors(i-1,x,y,dx,dy);
gr->SetTitle(“U-238 n,fiss Cross-Section”);
/// Define Legend, Set Options, etc
TLegend *leg = new TLegend(0.12,0.75,0.3,0.9);
leg->AddEntry(“gr”,“UKy Prelim Data”,“l”);
leg->AddEntry(“grK”,“World Data (EXFOR)”,“l”);
I’m unsure why the information is not passing the specifics of the points. grK should be a blue triangle, gr should be a red dot. Both show in the legend as a black square. Any ideas?