Function not plotted

I am trying to fit a graph with predefined function gaus (or anything). Graph is getting drawn, but function is not drawn. If go to editor of plot, cursor shows the function. No help from changing color of that un-seen distribution. Same code works fine in other OS.

Also I see something peculiar, opacity of graph (and un-seen object) is freeze. I mean I can not change it from 1 to 0 or anything.
Please help.

Here are system info:
Ubuntu 16.04.2 LTS, x86-64, gcc 5.4.0, root version (binary 5.34/30)

It should work. Do you have a small script reproducing this problem ?

Also, can you try to start root with option -n ie: root -n
It might be that you have something preventing the fit drawing inside your rootlogon.C.

Hi couet,
Thank you for quick response.
I have run the code root -n test.C, but of no help.

Here is full code:

  ifstream infile("test.txt");
  float x[10],y[10],z[10];
  int count =0;
  while(infile){
      infile>>x[count]>>y[count]>>z[count];
      if(infile.eof()) continue;
      cout<<x[count]<<"\t"<<y[count]<<"\t"<<z[count]<<endl;
      count++;
    }
  TGraph *gr = new TGraph(count, x,y);
  gr->Fit("gaus");
  gr->Draw("al");

And the test.txt file is:

10	537	2.861 
20	632.2	4.019
30	624.4	2.772
40	672.9	2.542
50	725.6	2.596

Try:

gr->Fit("pol1");

Sorry, Wile_E_Coyote. No help. Problem persists.

It is fine for me:

root [0] 
Processing srikanta.C...
10	537	2.861
20	632.2	4.019
30	624.4	2.772
40	672.9	2.542

****************************************
Minimizer is Minuit / Migrad
Chi2                      =      1346.29
NDf                       =            1
Edm                       =  3.34285e-07
NCalls                    =          151
Constant                  =      665.551   +/-   43.5956     
Mean                      =      41.6061   +/-   25.3135     
Sigma                     =      50.3097   +/-   37.9442      	 (limited)
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
root [1] 

Hi couet,
It is working fine in other’s Ubuntu OS (16.04) as well, but not in my Ubuntu OS. I re-installed root using both methods, cmake and in binary, but it did not work.

Thanks any way.

Can it be that you have Ubuntu’s “system-provided” ROOT related packages installed?
Execute “sudo apt-get purge root-system* root-plugin* libroot*” (afterwards check that the “/usr/lib/i386-linux-gnu/root5.34” and the “/usr/lib/x86_64-linux-gnu/root5.34” subdirectories disappeared completely)

what do you get as terminal output when you run the macro ?

The same what you get and the graph as you have posted. Only fit function (red-curve) is not present.

Hi Wile_E_Coyote,
I executed the command and it removed files from /usr/lib/x86_64-linux-gnu/root5.34. Now re-run the code, but it did not help.

Thanks any way.

Can you save the canvas as a .root file and post it here ?

test.root (16.6 KB)
Hi couet,
Please find the file attached.

Your own ROOT is broken. After you removed the Ubuntu’s “system-provided” ROOT 5 related packages, you MUST configure and build your ROOT 5 completely from scratch again.

Yes your ROOT should be somehow broken.
The file you sent seems a bit weird.
Can you save the canvas as a .C and send it ?

test.C (2.8 KB)
Hi couet,
After following instructions as said by Wile_E_Coyote, I re-run the code and saved the macro. Please have a look.

Hi Wile_E_Coyote,
I followed the steps and found that from Prerequisites, libjpeg was not installed. So I did it and then I re plot it (unfortunately the problem remains same). Please find the root macro attached in a reply to couet.

Your “saved” macro is fine. When I run it I get the following picture:

and you can see in the code that the fit function is there.
So your root should have something wrong as Wile said.

configure.out.txt (8.0 KB)
make.out.txt (480.5 KB)

Hi Wile_E_Coyote,
I see some issues on one of output file (both attached here) which was created while following instructions as mentioned in your reply. Please have a look and let me know if I am making some mistakes.

From the “configure.out.txt”, I think you should at least install “libgsl-dev” and “python-dev”.

I cannot access “make.out.txt” (“page doesn’t exist or is private”).