How can I scale the ticklabels in Tikz to replicate the Matlab command

set(gca, 'XTick', xt, 'XTickLabel', xt.^3)

As an example, the xtick labels should be converted to the following


I want to have an automated procedure for this. Something like this:


Sadly, tikz can not parse this...


Just use xticklabel={\pgfmathparse{\tick^3}$\pgfmathprintnumber{\pgfmathresult}$} as in the following example. If you have huge numbers, you might want to use fpu.

\addplot [domain=0:35] {x};

enter image description here

  • Thanks for your reply. If I replace your domain from "domain=0:8" to "domain=0:35", I get dimensions too large, how can I solve this? – user2978680 Nov 11 '18 at 15:42
  • @user2978680 I added instructions for that case. – user121799 Nov 11 '18 at 15:49

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.