# Formatting ticks of axes to scientific format and modifying the labels [duplicate]

I was trying to plot a function, but had a problem with the tick labels staying close to each other (top plot).

DiscretePlot[RmvsB[b], {b, bmin, bmax, bstep}]


So, I decided to play with the ticks increasing the labels step size and got the following result (bottom plot).

DiscretePlot[RmvsB[b], {b, bmin, bmax, bstep},
Ticks -> { N[Table[i, {i, bmin, bmax, (bmax - bmin)/5}]], Automatic}]


As you can see the first number is in scientific format while the rest in the general form. Is there way to force the tick labels to show up in the scientific format, i.e Nx10^-7 ?

Another question is lets say the function argument range is in meters. Is there any way to convert meters to micrometers, i.e.a value of 100 would show up instead of the actual value of 1x10^-4?

Thanks a lot for your help

• Take a look at ScientificForm – paw Sep 25 '14 at 0:58
• I tried Ticks-> ScientificForm[N[Table[.....]]], it didn't work out. Elements used as ticks must be either a list or numbers. So, I am guessing Scientific format converts everything to string or smth, and it causes errors – Olzhas Sep 25 '14 at 1:36

To get the ticks in ScientificForm you have to provide the ticks in the following form: Tick->{{1,"Label1"},...}

bmin = 0;
bmax = 2*10^-5;
bstep = 1*10^-6;

DiscretePlot[-7*10^8 b + 15000 , {b, bmin, bmax, bstep},
Ticks -> {Table[{i, ScientificForm[N@i, 3]}, {i, bmin, bmax, (bmax - bmin)/5}], Automatic}]


The unit conversion can be implemented with UnitConvert:

dataUnit = "m";
plotUnit = "nm";

DiscretePlot[-7*10^8 b + 15000 , {b, bmin, bmax, bstep},
AxesLabel -> {plotUnit, None}, Ticks -> {Table[{i,
ScientificForm[N@i QuantityMagnitude@
UnitConvert[Quantity[1, dataUnit], plotUnit], 3]}, {i, bmin, bmax, (bmax - bmin)/5}], Automatic}]


• Awesome! Thanks a lot – Olzhas Oct 2 '14 at 19:47