When plotting in Mathematica, HoldForm[-5*10^6] gives $-5\: 10^6$ as the label of the axis, i.e. without the multiplication sign. How can I get $-5*10^6$ as output?

Edit: This problem only occurs due to the minus sign, without the minus sign the output is as desired.


There is a dilemma here: You want the * which can easily be done by displaying an expression as InputForm but then, even the ^ will be displayed because it is the way you input it.

So what you can use is


to display the multiplication. If this does not satisfy your needs, then simply use a string where you have typed the ^6 with Ctrl+Shift+6. This looks awful when I paste it here

"-5*\!\(\*SuperscriptBox[\(10\), \(6\)]\)"

but it works in a plot. So when you want to use this as axes label in a plot, just do something like

Plot[x, {x, 0, 1}, 
  AxesLabel -> {"-5*\!\(\*SuperscriptBox[\(10\), \(6\)]\)", "NoMatter"}]

Mathematica graphics

  • $\begingroup$ I don't think this answers the posers question, as the particular values he wants to display will be generated automatically, not individually "by hand." $\endgroup$ – David G. Stork May 3 '15 at 16:24
  • $\begingroup$ @LCF I have added an example on how to use it. Please, is it possible that you give a very small snippet of code where we see what you try to do? $\endgroup$ – halirutan May 3 '15 at 16:37
  • $\begingroup$ Thank you very much, that solved my problem. $\endgroup$ – Thomas May 3 '15 at 16:38
  • 1
    $\begingroup$ @David. Thanks for your help as well! And I am a "she", not a "he". ;) $\endgroup$ – Thomas May 3 '15 at 16:45
  • $\begingroup$ On my Mac cmd+shift+6 doesn't work, whereas ctrl+^+6 works. I have no idea why, but thought I should mention it. +1 $\endgroup$ – C. E. May 3 '15 at 16:45

This works in v. 10.1:

Plot[Sin[x/1000], {x, 1, 20000},
 Ticks -> {{{3000, 
     Text[Style["3 * \!\(\*SuperscriptBox[\(10\), \(3\)]\)", 
       Italic]]}, {6000, 
     Text[Style["6 * \!\(\*SuperscriptBox[\(10\), \(3\)]\)", 
       Italic]]}}, Automatic}]

though I must say I find the asterisk ugly, useless and old fashioned.


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.