Curve saved as polyline in root file

I have code that makes a TGraph, saves the canvas as a pdf and writes the graph to a root file. On the pdf It shows as a curve, which is the option I used, but in the output root file it’s saved with a polyline! I can’t work out why. The code is as below:

TCanvas SherpaLundPythiaCutCanvas25;
         TGraphErrors *SherpaLundPythiaCutGraph25 = new TGraphErrors(numberEntries,x25,y25, ey25, ex25);
         SherpaLundPythiaCutGraph25->Draw("ACP");
            auto PythiaCutLegend25 = new TLegend(0.6,0.7,0.8,0.9);
   PythiaCutLegend25->SetHeader("Legend","C"); // option "C" allows to center the header
   PythiaCutLegend25->AddEntry(SherpaLundPythiaCutGraph25,"SherpaLund 25% Fixed Efficiency (Pythia Cut)","l");
   PythiaCutLegend25->Draw();
                 SherpaLundPythiaCutGraph25->Write("SherpaLundPythiaCutGraph25");
        SherpaLundPythiaCutCanvas25.Print("SherpaLundPythiaCutGraph25.pdf");

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Drawing options are not saved. After reading a “saved” graph from a file, you need to draw it again using “ACP”.

1 Like

Ah I was just using the TBrowser so that didn’t occur to me, thanks :slight_smile:

In the TBrowser, you can find the “Draw Option:” field, where you can set “ACP”.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.