How to use Charting`ScaledFrameTicks to produce tick specifications for log-scaled plots?

You have the gist of Charting`ScaledTicks, but how to feed this as an option to LogLinearPlot is a major roadblock here.

First, take the tick marks you get from Charting`ScaledTicks and rescale the first argument by the inverse of the log function in question

Module[{xticks = Charting`ScaledTicks[{Log, Exp}][Log[1], Log[100]]},
    xticks[[All,1]] = Exp@*First/@xticks;
    LogLinearPlot[Tanh[x], {x, 1, 100}, ImageSize -> Small, 
      Ticks -> {xticks, Automatic}]
]

Mathematica graphics

Another way is to take the tickmarks you find, and feed them to a wrapping Show

With[{xticks = Charting`ScaledTicks[{Log, Exp}][Log[1], Log[100]]},
   Show[
      LogLinearPlot[Tanh[x], {x, 1, 100}, ImageSize -> Small], 
      Ticks -> {xticks, Automatic}]
]

Mathematica graphics


You can use TracePrint to capture the Charting`ScaledTicks call the FrontEnd uses:

Last @ Reap @ TracePrint[
    Rasterize @ LogLinearPlot[Tanh[x],{x,1,100}, Ticks->{Automatic,Automatic}],
    _Charting`ScaledTicks[__],
    TraceAction->Sow,
    TraceInternal->True
]

{{Charting`ScaledTicks[{Log,Exp}][-0.306331,4.9115]}}

It evaluates to:

ticks = Charting`ScaledTicks[{Log,Exp}][-0.30633099404439457`,4.911501180032486`];
Cases[ticks, {_, _Integer, __}]

{{0.,1,{0.01,0.},{AbsoluteThickness[0.1]}},{0.693147,2,{0.01,0.},{AbsoluteThickness[0.1]}},{1.60944,5,{0.01,0.},{AbsoluteThickness[0.1]}},{2.30259,10,{0.01,0.},{AbsoluteThickness[0.1]}},{2.99573,20,{0.01,0.},{AbsoluteThickness[0.1]}},{3.91202,50,{0.01,0.},{AbsoluteThickness[0.1]}},{4.60517,100,{0.01,0.},{AbsoluteThickness[0.1]}}}

The first column is just Log of the second, or in other words, Exp of the first column yields the second column:

Cases[ticks, {p_, i_Integer, ___} :> {Exp[p], i}]

{{1.,1},{2.,2},{5.,5},{10.,10},{20.,20},{50.,50},{100.,100}}


Bear in mind that all the visualization functions(Plot, ListPlot, BarChart, etc...) try to parse options in a transformed domain, meaning when you specify to put "label" at 10 in LogLinearPlot, it will put "label" at Log[10]. So here if we scale back the position, it will work as expected.

This utility is more helpful in Graphics or Show, when you need to create your own vis function.

xticks = MapAt[Exp, Charting`ScaledTicks[{Log, Exp}][Log[1], Log[100]], {All, 1}];
LogLinearPlot[Tanh[x], {x, 1, 100}, Ticks -> {xticks, Automatic}]

enter image description here

or

xticks = Charting`ScaledTicks[{Log, Exp}][Log[1], Log[100]];
Show[LogLinearPlot[Tanh[x], {x, 1, 100}], Ticks -> {xticks, Automatic}]

enter image description here