Plot[x^2, {x, 0, 100},Ticks -> {{#, ScientificForm@#} & /@ Range[0., 100., 30.], {#, ScientificForm@#} & /@ Range[0., 100^2, 1000.]}, PlotRange -> All];

PowerTicks[label_][min_, max_] :=Block[{min10, max10}, min10 = Floor[Log10[min]]; max10 = Ceiling[Log10[max]]; Join[Table[{10^i,If[label, Superscript[10, i], Spacer[{0, 0}]]}, {i, min10, max10}], Flatten[Table[{k 10^i,Spacer[{0, 0}], {0.005, 0.},{Thickness[0.001]}}, {i, min10,max10}, {k, 9}], 1]]] ListLogLogPlot[Range[20]^3, Frame -> True, FrameTicks -> {{PowerTicks[True],PowerTicks[False]}, {PowerTicks[True], PowerTicks[False]}}]

The above code works very well for the positive powers. Could some one please check it how does it change for the negative powers. More specific, on both axes the scales should be ranging {10^-5, 10^-4....10^0, 10^1, 10^2,...10^5}. Thanks!


The axes are scaled to the data. If only want to change the axes with the same data you may use PlotRange:

ListLogLogPlot[Range[20]^3, Frame -> True, 
 FrameTicks -> {{PowerTicks[True], 
    PowerTicks[False]}, {PowerTicks[True], PowerTicks[False]}}, 
 PlotRange -> {{10^-5, 10^5}, {10^-5, 10^5}}]

enter image description here

However, MMA does this automatically if the data span this range. E.g.:

dat = Join[(1/Range[40])^3, Range[40]^3];
dat = Transpose[{dat, dat}];
ListLogLogPlot[dat, Frame -> True, 
 FrameTicks -> {{PowerTicks[True], 
    PowerTicks[False]}, {PowerTicks[True], PowerTicks[False]}}]

enter image description here

  • $\begingroup$ Thanks, it worked! My data includes the negative powers, so the the second option is relevent to me. By the way, how do you get the tick markers more darker in your images above. Mine are the same, but dimmer. $\endgroup$ – SciJewel Feb 27 at 17:25
  • $\begingroup$ Well, I did not do anything and did not even realize it. But in between you edited your code, PowerTicks is no more working. $\endgroup$ – Daniel Huber Feb 27 at 17:37
  • $\begingroup$ So, you are not using PowerTicks from my code above? $\endgroup$ – SciJewel Feb 27 at 18:47
  • $\begingroup$ Yes, I am using PowerTicks but if I try my code it does no more run. And you changed your code. Therefore I assume you changed PowerTicks as I did not change my part. $\endgroup$ – Daniel Huber Feb 27 at 19:16
  • $\begingroup$ Hubel: No, I have not changed anything, I guess someone else might have changed it. $\endgroup$ – SciJewel Feb 27 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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