Plot saved as .C won't open

I’m trying to make a plot, save it, and open it. To save it, I right-clicked, hit save as, and named it sample.C. When I try to open the plot, I get an error saying that it’s not in the macros folder, but it is!

root [0] TGraphErrors gr("/home/frankie/Software/root-6.10.04/documentation/primer/macros/ExampleData.txt");
root [1] gr.Draw("AP");
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
root [2] Info in <TFrame::SaveAs>: C++ Macro file: sample.C has been generated

root [2] .x sample.C;
Error in <TApplication::ExecuteFile>: macro sample.C; not found in path .:/home/frankie/Software/root/macros

I think that it might be a problem with the graphics, since running graphical Linux applications on Windows isn’t officially supported. But I’d rather not spend another three days trying to install ROOT on Windows if I don’t have to.


ROOT Version: 6.10.04
Platform: Ubuntu on Windows, with Xming for graphics
Compiler: ?


Remove the “;” character.

If I just do .x sample.C then nothing happens at all.

Instead of “right-clicked, hit save as” try the “c1 canvas main menu” -> “File” -> “Save” -> “c1.C” (and then “.x c1.C”).

That worked, thank you!!

Do you know how I can change the name of the graph if I’m saving it this way?

Why don’t you try “canvas main menu” -> “File” -> “Save As...”?

Ah OK. I didn’t realize that would be different than right-clicking and hitting save as. Thanks for your help! :slight_smile:

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