Tell me more ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to express the ticks in scientific form. I tried two ways as following

ListLogPlot[Table[{x, 10^x}, {x, -1, 1}], Ticks -> {Automatic, {10^-1, 10^0, 10^1}}]

ListLogPlot[Table[{x, 10^x}, {x, -1, 1}],  
                          Ticks -> {Automatic, ScientificForm[{10^-1, 10^0, 10^1}]}]

enter image description here

but they just could not work as you can see; the latter even is wrong.

Why & how?

Edit by @belisarius

Scientific Notation is usually understood as ${1.\times 10^{-2}}$, however the OP wants just ${10^{-2}}$. Solutions for both cases can be found in the answers below.

share|improve this question
I believe this is a duplicate but as my vote is binding I shall hold it for the time being: mathematica.stackexchange.com/q/5369/121 – Mr.Wizard Aug 17 '12 at 19:22
@Mr.Wizard , thanks! I should ever find that link before; however i failed to use proper key words. Anyway, i think the command Superscript is the simplest way to fulfill my requirement. – Mathieu Aug 18 '12 at 16:59

3 Answers

up vote 7 down vote accepted

Here's one possibility. In this case, Superscript provides the needed format of exponents but Table helps in formatting Ticks over sets of values.

ListLogPlot[Table[PartitionsQ[n], {n, 50}], 
Ticks -> {Automatic, Table[{10^k, Superscript[10, k]}, {k, -2, 5}]},
PlotRange -> {Automatic, {1/1000, 10^5}}]

output

share|improve this answer
So far i found the Superscript is the easiest way to realize the 10^n format, as long as one notice the code need to be the form: {position, label} as Verde also pointed out. Thank you for your answer! – Mathieu Aug 18 '12 at 17:06
Thanks. Sometimes a simple approach will do the job. – David Carraher Aug 18 '12 at 17:30

You need the second form for the ticks {position, label}.

As in

ListLogPlot[#, Ticks -> {Automatic, {#, ScientificForm@#} & /@ #}] &@Array[10.^# &, 10]

Mathematica graphics

share|improve this answer
wow, ur code is very simple.It seems that the decimal point is crucial. If using Array[10^# &, 10], it goes back to ordinary form. Actually here i want the form like 10^1, 10^2,... without "1.". – Mathieu Aug 18 '12 at 5:18

I would suggest using the CustomTicks package. After loading the package, you do:

ListPlot[Table[{x, Log10[10^x]}, {x, -1, 1, .1}], Ticks -> {Automatic, LogTicks}]

Mathematica graphics

You can also specify to use CustomTicks's linear ticks:

ListPlot[Table[{x,Log10[10^x]},{x,-1,1,.1}],Ticks->{LinTicks,LogTicks}]

which gives a slightly different result:

Mathematica graphics

There are many options in this package to modify the ticks style, spacing, etc. See the complete user's guide.

share|improve this answer
That's powerful! I guess there would be one day i use that package for beautiful presentation. – Mathieu Aug 18 '12 at 17:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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