Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exponential form of tick marks for log plot in Mathematica

In an attempt to learn more Mathematica, I am trying to reproduce the tick marks on this log (log) plot: enter image description here

This is as close as I can get:

LogLogPlot[Log[x!], {x, 1, 10^5}, PlotRange -> {{0, 10^5}, {10^-1, 10^6}}, Ticks -> {Table[10^i, {i, 0, 5}], Table[10^i, {i, -1, 6}]}]

enter image description here

Question

How can I make tick marks that are always of the form 10^n for appropriate values of n?

like image 538
Tyson Williams Avatar asked Oct 22 '11 14:10

Tyson Williams


2 Answers

Superscript, the generic typesetting form without any built-in meaning, is your friend for this.

LogLogPlot[Log[x!], {x, 1, 10^5}, 
   PlotRange -> {{0, 10^5}, {10^-1, 10^6}}, 
   Ticks -> {
       Table[{10^i, Superscript[10, i]}, {i, 0, 5}], 
       Table[{10^i, Superscript[10, i]}, {i, -1, 6}]
       }
   ]
like image 114
Brett Champion Avatar answered Sep 30 '22 19:09

Brett Champion


To expand on the previous answers, you can calculate the right range for the Tables in the Ticks option automatically by doing something like

ticksfun[xmin_, xmax_] := 
 Table[{10^i, Superscript[10, i]}, {i, Floor[Log10[xmin]], 
   Ceiling[Log10[xmax]]}]

LogLogPlot[Log[x!], {x, 1, 10^5}, 
 PlotRange -> {{0, 10^5}, {10^-1, 10^6}}, 
 Ticks -> {ticksfun, ticksfun}]
like image 37
Heike Avatar answered Sep 30 '22 19:09

Heike