6
$\begingroup$

How can I most cleanly force Mathematica not to print ticks in scientific notation? Do I have to manually provide the tick labels?

Rendering the numbers in exact form would be sufficient. If there is a way to express formatting with a function that would be optimal.

Plot[x, {x, 0, 10^10}]

enter image description here

$\endgroup$
2
  • $\begingroup$ What would you like the tick labels to look like, then? $\endgroup$ Aug 26, 2017 at 2:03
  • $\begingroup$ Good question -- let me add more detail. Thanks. $\endgroup$
    – mfvonh
    Aug 26, 2017 at 2:04

2 Answers 2

4
$\begingroup$
longticks = 
  Show[#, AbsoluteOptions[#, 
      Ticks] /. {n_?NumberQ, n_, a_List, b_List} :> {n, AccountingForm[n], a, b}] &;

Plot[x, {x, 0, 10^10}] // longticks

enter image description here

Recommended reading:

$\endgroup$
1
  • 1
    $\begingroup$ Does this still work with MM 13? I'm copy-pasting this code and get numbers in the format of 8*^9 etc. $\endgroup$
    – tukan
    Jun 8, 2022 at 16:12
4
$\begingroup$

Use the Table function or something similar within the Ticks option to make this easy on you. Consider this, which changes the y-axis ticks, while leaving the x-axis ticks alone:

Plot[x, {x, 0, 10^10}, 
 Ticks -> {Automatic, Table[{2 i 10^9, 2 i 10^9}, {i, 1, 5}]}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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