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: