I want to change format of x or y number in green box of below graph
.
Asked
Active
Viewed 3,933 times
5
-
This is covered in the manual quite extensively. At which point are you stuck? – percusse May 04 '12 at 07: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 04 '12 at 07:55
-
I want change 1o^2 to 100 – sayros May 04 '12 at 07:57
-
possible duplicate of pgfplots ticklabel format logarithmic scale – hpekristiansen Oct 25 '14 at 15:47
2 Answers
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
Christian Feuersänger
- 55,840
-
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
-
1this 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
-
1oh, why - simply keep it. It is always good to have a reference for these things. – Christian Feuersänger May 04 '12 at 19:40