Minimum number of digits on axis labels

Hi,

I have an x-axis that shows e.g. these labels:
2.8    2.9    3    3.1    3.2

Can I change that so that it doesn’t say 3 but 3.0? I.e. so that the labels would show up as:
2.8    2.9    3.0    3.1    3.2

Thanks!

Paul

Hi Paul,

This is already possible when using TGaxis directly (OptionDot).
I will implement an interface from TAxis as well.

Rene

Hi,

I’m sorry, I don’t understand how to do this.
I can’t find a function OptionDot() or SetOptionDot() in TGaxis or TStyle.
I also can’t find an option to pass to TGaxis::SetOption(char* ) that allows me to do what I want.

Can you please explain to me specifically what I should do?

Thanks,

Paul

TGaxis::PaintAxis has a drawing option “.” that forces what you want (see code).
This option was supposed to be interfaced to TAxis. It could be that I will implement
a TStyle option instead.

Rene

I see, thanks.

I had actually looked at the documentation of TGaxis::PaintAxis, but it doesn’t mention this option. May I suggest the documentation in the code be changed slightly:

(…)
// Format of labels.
// -----------------
//
// Blank characters are stripped, and then the
// label is correctly aligned. The dot, if it is the
// last character of the string, is also stripped,
// unless the option “.” (a dot, or period) is
// specified.
(…)

Thanks again.

Paul

Paul,

Age effect? What you request is already in place. You can call
gStyle->SetStripDecimals(kFALSE);

I have added functions in TAxis and TGaxis to select this option at the axis level.
Now in CVS.

Rene

Great, thanks.

Re: the documentation in the code: The current documentation has a bit about “Format of labels”, but I modified the first paragraph, adding a comment about the option “.” (dot).

Paul

Hi Paul,

Yes, I already took your comment yesterday and added a bit more.
see:http://root.cern.ch/root/htmldoc/TGaxis.html#TGaxis:PaintAxis

Rene