3
$\begingroup$

Plotting f[x] as below

 f[x_] = 4.4978`/x^2 - 1.9057/x + 1000 x + 10 x^2;
LogLogPlot[{(f[x])^(-1/2)}, {x, 0, 1}, Frame -> True, 
 LabelStyle -> {16, FontFamily -> "Times"}, ImageSize -> 350]

leads to the following plot

enter image description here

How can one show the points on the horizontal axis in a non-congested way?

$\endgroup$

1 Answer 1

5
$\begingroup$
scaledTicks = Charting`ScaledTicks[{Log, Exp}];
scaledTicksNoLabels = Charting`ScaledFrameTicks[{Log, Exp}];

llp = LogLogPlot[{(f[x])^(-1/2)}, {x, 0, 1}, Frame -> True, 
   LabelStyle -> {16, FontFamily -> "Times"}, ImageSize -> 350];

llp2 = Show[llp, 
   FrameTicks -> 
   {{scaledTicks, scaledTicksNoLabels}, 
    {scaledTicks[##] /. {a_Real, n_, b___} :> {a, Rotate[n, -90 Degree], b} &,
     scaledTicksNoLabels}}];

Row[{llp, llp2}, Spacer[20]]

enter image description here

$\endgroup$
3
  • $\begingroup$ In the plot on the right, on the $x-$axis, why are the first and last numbers not rotated? Is that a desired feature? $\endgroup$
    – mjw
    Commented May 31, 2023 at 12:52
  • $\begingroup$ @mjw, updated with a fix. $\endgroup$
    – kglr
    Commented May 31, 2023 at 18:57
  • $\begingroup$ Thank you!${}{}{}{}{}$ $\endgroup$
    – mjw
    Commented May 31, 2023 at 22:27

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.