In an attempt to learn more Mathematica, I am trying to reproduce the tick marks on this log (log) plot:
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}]}]
How can I make tick marks that are always of the form 10^n for appropriate values of n?
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}]
}
]
To expand on the previous answers, you can calculate the right range for the Table
s 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}]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With