5

I want to change format of x or y number in green box of below graph .enter image description here

sayros
  • 2,629

2 Answers2

12

If you intend to change the formatting of an axis with linear scale (i.e. "normal" numbers), you can proceed as in Joseph's answer, i.e. by modifying the keys with /pgf/number format/ prefix.

Log-axes however require the log ticks with fixed point key; it reconfigures pgfplots to produces fixed point representation for log axes:

\begin{axis}[log ticks with fixed point]
...

This style requires the most recent pgfplots stable version 1.5.1

  • See also http://tex.stackexchange.com/a/139084/38080 (linked for the next one searching...) – Rmano Feb 09 '16 at 18:41
10

You can change the formatting for an axis using the every ... system. For example

  \begin{axis}
    [
      every x tick label/.append style  =
        { 
          /pgf/number format/.cd,
           precision = 0, 
           fixed
        }
    ]

should I think work here. This works by adding some basic pgf number formatting instructions to the end of the code which is used to print the tick labels.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
  • 1
    this approach works well for non-logarithmic axes. Axes with log scale are treated with a different code, in this case, only the exponent is affected by number printing (since many people want an exponent even if it is a real number). – Christian Feuersänger May 04 '12 at 19:36
  • @Christian. Hmm, in that case my answer is wrong. Would you write an answer and let me know, and I'll delete this one. – Joseph Wright May 04 '12 at 19:39
  • 1
    oh, why - simply keep it. It is always good to have a reference for these things. – Christian Feuersänger May 04 '12 at 19:40