Home | News | Documentation | Download

Change the number of significant digits?


#1

Hi, i have created a label on my graphs thanks to options->fit parameters now i want to change the number of digits, how can i do?

prova


#2

gStyle->SetFitFormat("g");


#3

I have not created the label from the program but i have put it from the image that i posted before with option->fitparameters .


#4

Moreover i want different number of significant digits in a and Erra, how can i do?


#5

Can you provide a small macro showing what you are Doing ?


#6

The macro is:

ist.C (8.9 KB)

I create the label from this window with option and fit parameter:

Cattura


#7

I see you create the fits parameter box yourself via:

  TPaveText *r=new TPaveText(0.8,0.8,1,1,"brNDC");

… Why not that’s you choice … and later you fill that box with :

  r->AddText(Form("#chi^{2} / DF = %3.1lf / %1.0lf ",chi2,df));
  r->AddText(Form("Prob = %3.4lf  ",prob));

That’s correct and you have the full control on the number formatting in that case … just adjust the format to have the precision you need.

Note you are not using the option fits …


#8

Yes, this is the metod that i used before but then i have discovered that thanks to option->fit parameters i can create label without TPaveText. Now how can i do with this new method ?


#9

The simplest is to put the following command at the beginning of your macro:

gStyle->SetOptFit(1);

#10

Where ? It gives me error:

ist.C (8.9 KB)

Moreover how can i overcome this problem with TPave:

Cattura


#11

Here is a version which is working for me. No error.
ist.C (5.8 KB)


#12

It gives me: gstyle undefined identifier.


#13

it is not gstyle but gStyle … (S uppercase). The macro i sent you should work as it is … I just ran it is fine for me.


#14

I have tried your macro and it gives me the same error also with gStyle


#15

I just downloaded it again and ran it and it is fine (with ROOT 5 and ROOT 6). Which ROOT version are you using ? on which machine ? can you copy/paste here the output you get ?


#16

I am using a version of 2012 with visual studio. Anyway i will use Tpave… but how can i overcome this problem :Cattura ?

Thanks :slight_smile:


#17

Even with 2012 version gStyle->SetOptFit(1); should work. This setting has always been there.

Please, can you copy paste here the exact error message you get ?

When I run the last version of the ist.C macro I do not see the plot you are showing.
Can you provide me a version of the macro producing this plot ?


#18

Concerning the first problem i will paste the exact error message when i will turn the language of windows into english.

For the second problem:

ist.C (9.0 KB)

If you look at the last graph you will see only one label but if you try to move it you will discover that there will be four label


#19

Fixed in ist.C (9.0 KB)


#20

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