5

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

4
  • This is covered in the manual quite extensively. At which point are you stuck?
    – percusse
    May 4, 2012 at 7:55
  • In what way? There are lots of ways of altering the formatting, so we need to know what you mean (font, size, decimal places, ...).
    – Joseph Wright
    May 4, 2012 at 7:55
  • I want change 1o^2 to 100
    – sayros
    May 4, 2012 at 7:57
  • possible duplicate of pgfplots ticklabel format logarithmic scale Oct 25, 2014 at 15:47

2 Answers 2

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.

3
  • 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). May 4, 2012 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 4, 2012 at 19:39
  • 1
    oh, why - simply keep it. It is always good to have a reference for these things. May 4, 2012 at 19:40
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

1

Not the answer you're looking for? Browse other questions tagged or ask your own question.