5
$\begingroup$

I am wondering if there is a way to use custom ticks on FrameTicks but keep the tick "line marks" for the LogLog plot or LogLinear plot. This is the original plot: enter image description here

I want to switch the tick into the following, but keep the tick "line marks" for the log axis. Here the tick "line marks" disappear. enter image description here

The following code is used:

plist = Table[RandomReal[{0, 10000}], 100];
myTicks = Table[{10^i, Superscript[10, i]}, {i, -20, 15}];

(* without ticks *)
ListLogLogPlot[plist, Frame -> True,
 PlotRange -> {All, All}, PlotStyle -> {Thick, Black}, 
 PlotMarkers -> \[EmptyCircle]
 ]

(* with ticks *)
ListLogLogPlot[plist, Frame -> True,
 PlotRange -> {All, All}, PlotStyle -> {Thick, Black}, 
 PlotMarkers -> \[EmptyCircle],
  FrameTicks -> {{myTicks, None},{myTicks, None}} 
 ]
$\endgroup$

1 Answer 1

7
$\begingroup$

The list of tick marks can be in any order, so all we need to do is append the unlabeled tick marks to the existing list.

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

The unlabeled ticks can be generated by multiplying each of the labeled ones by the integers 2 through 9. Strictly speaking, the unlabeled ones have Null as their labels.

unlabeledTicks = Flatten[Table[{k*j, Null}, 
                     {k, 2, 9}, {j, labeledTicks[[All, 1]]}], 1];

Then

myTicks = Join[labeledTicks, unlabeledTicks];

(*with ticks*)
ListLogLogPlot[plist, Frame -> True, 
    PlotRange -> {All, All}, PlotStyle -> {Thick, Black}, 
    PlotMarkers -> \[EmptyCircle], 
    FrameTicks -> {{myTicks, None}, {myTicks, None}}]

enter image description here

$\endgroup$
2
  • $\begingroup$ This is so clever! Thank you so much!! $\endgroup$
    – fdjutant
    Commented Mar 22, 2021 at 20:09
  • $\begingroup$ This is so great! Thank you, Solved my problem spot on! $\endgroup$
    – yoav
    Commented Dec 15, 2021 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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