1

How can I x- and y-axis in logarithmic, but use the "normal" number format only on the x-axis?

I tried some stuff, as seen in the work example:

\documentclass{scrartcl}

\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[
    xmode=log,
     % still in logarithmic:
    xtick={1, 25, 50, 100},
    % obtuse and produces rounding errors in real examples, e.g, 63.99:
    % xticklabel={\pgfmathfloatparsenumber{\tick}\pgfmathfloatexp{\pgfmathresult}\pgfmathprintnumber{\pgfmathresult}},
    % changes both axes:
    % x tick label style={log ticks with fixed point},
    ymode=log,
    domain=1:100
    ]
    \addplot+ {ln(x)};
  \end{axis}
\end{tikzpicture}

\end{document}

Thanks!

2

Something like this?

\documentclass{scrartcl}

\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[
    xmode=log,
     % still in logarithmic:
    xtick={1, 25, 50, 100},
    % obtuse and produces rounding errors in real examples, e.g, 63.99:
    % xticklabel={\pgfmathfloatparsenumber{\tick}\pgfmathfloatexp{\pgfmathresult}\pgfmathprintnumber{\pgfmathresult}},
    % changes both axes:
    % x tick label style={log ticks with fixed point},
    ymode=log,
    xticklabel={\pgfmathparse{exp(\tick)}\pgfmathprintnumber{\pgfmathresult}},
    domain=1:100
    ]
    \addplot+ {ln(x)};
  \end{axis}
\end{tikzpicture}

\end{document}

enter image description here

2
  • 1
    Almost: I have rounded the result: ` xticklabel={\pgfmathparse{round(exp(\tick))}\pgfmathprintnumber{\pgfmathresult}}` because for some values, e.g., 64, it produces non-integer values. – Horus Apr 15 '19 at 12:51
  • @Horus Yes, that is one way. Alternatively you could e.g. use xticklabel={\pgfkeys{ /pgf/number format/fixed, /pgf/number format/fixed zerofill, /pgf/number format/precision=0} \pgfmathparse{exp(\tick)}\pgfmathprintnumber{\pgfmathresult}}. – user121799 Apr 15 '19 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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