Stuck on a simpler line color problem

Hey all,

I am having a problem setting a line colour to my ntuple - its such a simple task that I must be missing something obvious somewhere…

I set up an ntuple in a macro:

Then I fill it - also within the macro.

When the macro finishes I am now at the ROOT prompt and I can do all the usual stuff with ntuples, e.g.:

where in the above I am using the option l to draw a line through all the points. The problem is that I cannot set the line color from the prompt before I draw it.

I try using ntuple->SetLineColor(2);
but it makes no difference. If I check that it was set using the GetLineColor() method then sure enough, it returns the value 2.

I’ve even tried ntuple->GetHistogram()->SetLineColor(2);
but it sitll makes no difference. The ONLY way that I can change the colour is to manually click on the pad, get the TGraph drop down menu and change the line colour from there. However, I really need to automate this. Note that setting the line colour within the macro also fails.



ntuple->SetLineColor(2); ntuple->Draw("x:z","z>0","l");
When posting mails, always identify which version of ROOT


Sorry, I was using a slightly older version ROOT - v4.01 and had already tried the code you suggested without success.

I have since upgraded to v4.04.02-51 and it now works fine. I think it was because the line color was being set by TGraph - which in my older version of ROOT was not being set when trying

Many thanks