Message Boards Message Boards


Set Number Format for Frame Tick Labels

Posted 2 months ago
4 Replies
0 Total Likes

How to override the defaults and set the y-axis Frame Tick Number Format to one decimal place, and x-axis Frame Tick Number Format to Scientific Form with two decimal places. The simple plot (notebook attached) is an example using the following:

Plot[x 10^5, {x, 10^-5, 10^-4}]

Thank you.

4 Replies

Something like this?

pl = Plot[x 10^5, {x, 10^-5, 10^-4}];
tkz = AbsoluteOptions[pl, Ticks] /.
   {x_Real, lbl_Real, rest__} :>
    {x, If[lbl > 1, DecimalForm[lbl, {2, 1}],
      ScientificForm[lbl, {2, 1},
       NumberPadding -> {"", "0"}]], rest};
Show[pl, tkz]

Seems complicated, but It worked after replacing DecimalForm with NumberForm for my Mathematica 10.3. Thank you!

Posted 2 months ago

Hi Jack,

Take a look at the CustomTicks package.

Thank you Rohit. The CustomTicks package seems like it covers a great deal and would take a lot to learn and use. It is unfortunate that all the needed Options for Ticks are not included like other Options in Plots. I was hoping for a simpler and easier solution. Gorni's reply is more manageable, and perhaps can be made a little more general. Thanks again for the reference.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract