Message Boards Message Boards

0
|
5281 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Set Number Format for Frame Tick Labels

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.

Attachments:
POSTED BY: Jack Calman
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]
POSTED BY: Gianluca Gorni

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

POSTED BY: Jack Calman
Posted 3 years ago

Hi Jack,

Take a look at the CustomTicks package.

POSTED BY: Rohit Namjoshi

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.

POSTED BY: Jack Calman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract