8

I want the y-axis labels to be labeled 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10,000, …

PGFplots insists on keeping the 10^-notation in the following minimal example.

\documentclass[border=5mm]{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{loglogaxis}[y tick label style={/pgf/number format/fixed},
grid=both,
major grid style={black!50},xlabel={x},ylabel={y}]

\addplot[only marks, mark size=4pt,mark=triangle,fill,black] coordinates{
(0.000001, 13.5e3)
(0.0000024, 11.975e3)
(0.004, 4340)
(1 , 3840)
(10  , 2550)
(100 ,  2357)
(257, 2290)
(315, 2280)};

\end{loglogaxis}
\end{tikzpicture}
\end{document} 
Qrrbrbirlbel
  • 119,821
user39678
  • 381
  • 1
    Hi, welcome to TeX.SX. Does this help? http://tex.stackexchange.com/questions/29926/how-to-prevent-pgfplots-from-using-the-10n-notation-for-axis-ticks?rq=1 (Edit: Sorry, that was perhaps not so relevant.) – Torbjørn T. Nov 07 '13 at 21:26
  • 1
    The ticks from log axes are typeset a little bit differently and in fact have two to three options (the base, the exponent itself and how the exponent is typeset). That is related: Having tick labels like 1, 10, 10^2, 10^3, – Qrrbrbirlbel Nov 07 '13 at 21:40
  • 1
    There's an option for that: log ticks with fixed point, see e.g. here. – Tom Bombadil Nov 07 '13 at 21:47
  • @TomBombadil Which is unfortunately not listed in the Ticks chapter of the manual … – Qrrbrbirlbel Nov 07 '13 at 21:50
  • 1
    @Qrrbrbirlbel: It's in the number formatting section (which makes sense in a way, since it doesn't affect the placement of the ticks, only the formatting of the numbers) – Jake Nov 07 '13 at 21:51
  • @Qrrbrbirlbel: I only know of this since last week, and stumbled upon it by mere accident ;) – Tom Bombadil Nov 07 '13 at 21:55
  • @TomBombadil Very well, I usually just Ctrl+F the manual until I found something or my head starts to spin, whatever comes first. :) – Qrrbrbirlbel Nov 07 '13 at 21:58
  • If Jake's answer below solved your problem you could consider accepting his answer, by clicking on the checkmark just to the left of the answer. This marks the question as solved, and awards some points to both him and yourself. – Torbjørn T. Nov 12 '13 at 21:49

1 Answers1

9

To have both axes in logarithmic scale, but print the labels for only one of them in fixed point format, you can use the approach from pgfplots log ticks with fixed point: only for one axis?:

\documentclass[border=5mm]{article}
\usepackage{pgfplots}

\pgfplotsset{
  log x ticks with fixed point/.style={
      xticklabel={
        \pgfkeys{/pgf/fpu=true}
        \pgfmathparse{exp(\tick)}%
        \pgfmathprintnumber[fixed relative, precision=3]{\pgfmathresult}
        \pgfkeys{/pgf/fpu=false}
      }
  },
  log y ticks with fixed point/.style={
      yticklabel={
        \pgfkeys{/pgf/fpu=true}
        \pgfmathparse{exp(\tick)}%
        \pgfmathprintnumber[fixed relative, precision=3]{\pgfmathresult}
        \pgfkeys{/pgf/fpu=false}
      }
  }
}

\pgfplotsset{compat=1.9}

\begin{document}
\begin{tikzpicture}
\begin{loglogaxis}[
log y ticks with fixed point,
ytick={2000,4000,8000,16000},
grid=both,
major grid style={black!50},xlabel={x},ylabel={y}]

\addplot[only marks, mark size=4pt,mark=triangle,fill,black] coordinates{
(0.000001, 13.5e3)
(0.0000024, 11.975e3)
(0.004, 4340)
(1 , 3840)
(10  , 2550)
(100 ,  2357)
(257, 2290)
(315, 2280)};

\end{loglogaxis}
\end{tikzpicture}
\end{document} 
Jake
  • 232,450