The inline calculation exp(\tick) in PGFplots gives me a Could not parse input error when compiling the code

            log number format code/.code={\pgfmathprintnumber[sci,sci zerofill,precision=3]{exp(\tick)}}, % GIVES A 'COULD NOT PARSE INPUT' ERROR!
            \addplot[no marks,domain=10^0:10^5] {x};

How do I solve this?


Well as the macro name implies it is a pretty-printer not the math parser. You need to do the math outside and supply the result to it. But if you do the regular TikZ parsing the numbers are too big to handle. Hence you need to turn on the fpu of TikZ do the math and turn it off.

log number format code/.code={%
    \pgfmathprintnumber[sci,sci zerofill,precision=3]{\pgfmathresult}%

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.