If you want the minor ticks too, you can use the following function:
SetAttributes[dtZahl, Listable]
dtZahl[x_] := Block[{n}, If[IntegerQ[n = Rationalize[x]], n, x]]
exponentForm[x_?NumberQ] :=
Module[{me = MantissaExponent[x], num, exp},
If[MemberQ[{0, 0., 1, 1., -1, -1.}, x], Return[IntegerPart[x]]];
exp = Superscript["\[CenterDot]10", me[[2]] - 1];
num = NumberForm[N[me[[1]]]*10 // dtZahl, 3];
If[me[[1]] == 0.1,(*no mantissa*)num = "";
exp = Superscript[10, me[[2]] - 1],
If[me[[2]] == 1,(*range 0..10*)exp = ""]];
Row[{num, exp}]];
exponentForm[x_] := x
Options[logTicks] = {TicksFaktor -> 1};
logTicks[von_Integer, bis_Integer, werte_List, subwerte_List,
OptionsPattern[]] :=
Module[{mt, st, ticks, res, tf},
tf = OptionValue[TicksFaktor];
mt = {#, exponentForm[N[#]], {0.01, 0}*tf} & /@
Flatten@Table[10^i*werte, {i, von, bis}];
st = {#, Null, {0.005, 0}*tf} & /@
Flatten@Table[10^i*subwerte, {i, von, bis}];
Join[mt, st]]
logTicks takes the following Parameters:
von and bis are the lowest and highest exponent. The list werte is the list of labeled ticks in one decade and subwerte the list of unlabeled ticks in one decade.
Example:
GraphicsRow[{
ticks = logTicks[-4, 1, {1}, {2, 3, 5, 7}];
LogPlot[Abs[BesselJ[1, x] Sin[x]^2], {x, -10, 10}, Frame -> True,
FrameTicks -> {{ticks, None}, {None, None}}],
ticks = logTicks[-4, 1, {1, 3}, {2, 5, 7}];
LogPlot[Abs[BesselJ[1, x] Sin[x]^2], {x, -10, 10}, Frame -> True,
FrameTicks -> {{ticks, None}, {None, None}}]
}]
Output:
