# ListLogLinearPlot logarithmic axis tickmarks

When using ListLogLinearPlot the abscissa labels every other decade.

Is there a way to tell Mathematica to label each decade?

I need to use this inside Manipulate where the axes will scale according to the chosen variable. Here is some example code of the kind I am using:

s[x_] := (10^-9) x^2; t[x_] := (10^-3) x^2;
Manipulate[ ListLogLinearPlot[{ Table[{a s[T], T}, {T, 0, 1000}],
Table[{a t[T], T}, {T, 0, 1000}] },
GridLines -> None, PlotStyle -> {Thickness[0.005]}, Joined -> True,
PlotRange -> Automatic], {a, 10^-8, 10^8}]


## migrated from stackoverflow.comMar 30 '12 at 18:56

This question came from our site for professional and enthusiast programmers.

• Could you please give an example of code - best the one producing this graphics, or your manipulate. – Vitaliy Kaurov Mar 30 '12 at 20:04
• Perhaps this could help, see CustomTicksGuide.pdf, p. 4. – partial81 Mar 30 '12 at 20:40
• @VitaliyKaurov s[x_] := (10^-9) x^2; t[x_] := (10^-3) x^2; Manipulate[ ListLogLinearPlot[{ Table[{a s[T], T}, {T, 0, 1000}], Table[{a t[T], T}, {T, 0, 1000}] }, GridLines -> None, PlotStyle -> {Thickness[0.005]}, Joined -> True, PlotRange -> Automatic], {a, 10^-8, 10^8}] – CaptanFunkyFresh Mar 30 '12 at 21:29

You can create some custom ticks that work the way you want. There might be a better way than Superscript, but I couldn't work out how to get ScientificForm or NumberForm to just show the exponent rather than 1 x 10^4 etc.

myTicks = Table[{10^i, Superscript[10, i]}, {i, -20, 15}]


Notice I've changed the way the a variable enters into the Manipulate, as it will give you more chance to explore some of the lower-exponent values.

Manipulate[
ListLogLinearPlot[{Table[{10^a s[T], T}, {T, 0, 1000}],
Table[{10^a t[T], T}, {T, 0, 1000}]}, GridLines -> None,
Ticks -> {myTicks, Automatic}, PlotStyle -> {Thickness[0.005]},
Joined -> True, PlotRange -> Automatic], {a, -8, 8}] • ListLogLinearPlot[] uses Superscript[] too ... so it seems the way to go. – Dr. belisarius Mar 31 '12 at 15:35
• Thanks @Verbeia, this works just fine. I am now trying to implement this into FrameTicks where the upper horizontal tick marks are shown but without the decade labels, but this isn't a major concern. – CaptanFunkyFresh Apr 2 '12 at 14:50

One can adapt this answer to a smilar question to define a number format as follows:

 exponentForm[num_?NumericQ] :=
ToString@NumberForm[N@#1, ExponentFunction -> (# &), NumberFormat -> (#3 &)] &@num


Applied to a portion of Verbeia'a tick list, this function gives You can use it to define custom ticks with exponent labels:

  myExpTicks = Table[{10^i, exponentForm[10^i]}, {i, -20, 15}];


And, finally use it in your Manipulate as

 Manipulate[
ListLogLinearPlot[{Table[{10^a s[T], T}, {T, 0, 1000}],
Table[{10^a t[T], T}, {T, 0, 1000}]}, GridLines -> None,
Ticks -> {myExpTicks, Automatic}, PlotStyle -> {Thickness[0.005]},
Joined -> True, PlotRange -> Automatic], {a, -8, 8}]


to get You can create custom ticks and use ListPlot :

myTicks[lower_, upper_, step_] := Flatten[Module[{Local = #, LocalTicks},
LocalTicks = Log[10, Range[10^(# - 1), 10^#, (10^# - 10^(# - 1))/(10 - 1)]];
Join[{#, ""} & /@ Most[LocalTicks], {{Last[LocalTicks], Power[10,
ToString[Last[LocalTicks]]] }}]] & /@ Range[lower, upper, step], 1]

Manipulate[ListPlot[{Table[{Log[10, a s[T]], T}, {T, 0, 1000}], Table[{Log[10,
a t[T]], T}, {T, 0, 1000}]}, GridLines -> None, PlotStyle -> {Thickness[0.005]},
Joined -> True, PlotRange -> Automatic, Ticks -> {myTicks[lower, upper, step],
Automatic}, AxesOrigin -> {lower, 0}], {{lower, -20, "lower"}},
{{upper, 10, "upper"}}, {{step, 1, "step"}}, Delimiter, {a, 10^-8, 10^8}] 