gStyle

Hi ROOTERS!!! :smiley:

I have a probelm with gStyle…

I set the gStyle like “Modern” with command: gStyle->SetSStyle(“Modern”)
When I plot the data in a TGraphAsymmErrors with a specific Marker and color Marker, and with the errorbars. The result it is taht the errorbars it isn’t the same color of points, but it is black.

Then if i go on menu canvas, file, gstyle, it is setted “Modern”, but if i click apply the errorbars became the same color of point, but the point disappear!!! why??
How can set at the same time the same color for errorbars and the points?

Thank you a lot :wink: :wink:

Can you post a small example macro showing what you are doing ?

This is an example of macro, the purpose is very easy, obtain a Graph with point and asymmetric errorbars. But the problem is that the errorbars it is not the same color of marker, but it is black. For become the same color of marker I must to click on canvas menu, file, gstyle, and though it is already setted “Modern”, if i click apply, the errorbars become the same color of marke, but at this time the marke disappear and remian only the errorbars. I woul like draw the marker and errorbars with the same color, and so that you see it at the same time.

{
gROOT->SetStyle(“Modern”);

TCanvas *canvas = new TCanvas(“canvas”,“canvas”);
canvas->SetGrid();
gStyle->SetOptFit(1111);

TGraphAsymmErrors *a1 = new TGraphAsymmErrors (“Data.txt” , “%lg %lg %*lg %*lg %lg %lg %*lg %*lg %*lg %lg %lg %*lg”);
a1->SetTitle(“Graph”) ;
a1->SetLineWidth(2); a1->SetMarkerStyle(20); a1->SetMarkerSize(0.9); a1->SetMarkerColor(kBlue);
a1->Fit(“pol1”);
a1->GetFunction(“pol1”)->SetLineColor(2);

a1->Draw(“ap”);
return canvas;
}

Can you post Data.txt also ?
Note that the format you are using to read the file makes no sense…

The format file is simply a data file with 12 columns conteining only number.

Sorry why the format I am using to read the file makes no sense?? I take from the data file the 6 columns that interested me to plot a TGraphAsymmErrors. ( I am usign a ROOT-master)

Because assym errors have only 6 values maximum …
can you send the data file please ?

Infact If you see I have selected only 6 columns of 12 columns of the file, not all.

The example of file is this:

9.2011932 0.00460682814204 9.19946 9.20274 0.0017332 0.0015468 0.0017332 0.00451332920025 0.00467409196828 9.349894179e-05 6.726382624e-05 6.21330995958e-05
9.39669913333 0.00835110132473 9.39174 9.39989 0.00495913333 0.00319086667 0.00239086667 0.00452188041131 0.00853752912756 0.00382922091342 0.00018642780283 0.00382922091342
9.55462930851 0.0117013043781 9.54971 9.56096 0.00491930851 0.00633069149 0.00457930851 0.0114774354918 0.0119186779828 0.0002238688863 0.0002173736047 0.000207112151391
9.59831587786 0.0129239479114 9.59642 9.60044 0.00189587786 0.00212412214 0.00212412214 0.0123479487782 0.0130132329991 0.0005759991332 8.92850877e-05 0.000575999133154
9.80157703125 0.0180396615858 9.79974 9.80551 0.00183703125 0.00393296875 0.00183703125 0.0178361160399 0.0182363127178 0.0002035455459 0.000196651132 1.68351970057e-06
9.90074087719 0.0209201028096 9.89322 9.90676 0.00752087719 0.00601912281 0.00601912281 0.0205776343075 0.0210496611583 0.0003424685021 0.0001295583487 3.29146615785e-05

There are 12 columns but i take only 6 columns to plot in TGraphAsymmErrors.

{
   TCanvas *canvas = new TCanvas("canvas","canvas");
   canvas->SetGrid();
   gStyle->SetOptFit(1111);

   TGraphAsymmErrors *a1 = new TGraphAsymmErrors ("Data.txt" , "%lg %lg %*lg %*lg %lg %lg %*lg %*lg %*lg %lg %lg %*lg");
   a1->SetTitle("Graph") ;
   a1->SetLineWidth(2);
   a1->SetMarkerStyle(20);
   a1->SetMarkerSize(0.9);
   a1->SetMarkerColor(kBlue);
   a1->SetLineColor(kBlue);
   a1->Fit("pol1");
   a1->GetFunction("pol1")->SetLineColor(2);

   a1->Draw("ap");
}

aaa I must to SetLineColor!!! Good thanks =D> =D>

The problem of the line color is solved, but i need to set some parameters on gstyle menu, and when I click apply the marker disappear… how can i do?

thanks a lot :wink:

When you change the global style and do “apply” then all the default attributes in the style will be applied to you current plot. The default marker is the dot … that’s why the marker “disappear” … I do not recommend you use the style menu in your case… What is you goal doing that ?

what I don’t uderstand it is that it is already set a Modern style,the panel show me that the style setted is modern, I don’t change this in panel, but if click on apply the marker dissaper…

I need to go in panel for to set the position and dimension of parameters box, and if I need other things… it is very easy set from panel.

You have changed the marker style in your macro …
The panel apply what is in the panel …
So in the panel the marker is the point … that is why it shows a point…
but if you re-execeute you macro your will see the bullet again …
The style is the “background” of the attributes … then you are allowed to change them locally … that’s what you did in your macro …

AHhh ok now I have understood!!!

Thank you very much!!! :wink: :wink: :wink: