2
$\begingroup$

Consider the following tick-styling function

tickFunc = MapAt[Reverse, {All, 3}]@*Charting`ScaledTicks[{Identity, Identity}, "TicksLength" -> {.01, .005}];

which leads to

ListLinePlot[RandomReal[1, 10],
    Frame -> True, FrameTicks -> {{tickFunc, None}, {tickFunc, None}}]

enter image description here

Now, I want to invert the y-axis, which would supposedly be done with ScalingFunctions -> {Automatic, "Reverse"}, but

ListLinePlot[RandomReal[1, 10],
    Frame -> True, FrameTicks -> {{tickFunc, None}, {tickFunc, None}},
    ScalingFunctions -> {Automatic, "Reverse"}]

yields an error with the message "TerminatedEvaluation["RecursionLimit"]". How can I solve this?

Interestingly enough, with Plot this issue doesn't occur

Plot[x^2, {x, 0, 10},
    Frame -> True, FrameTicks -> {{tickFunc, None}, {tickFunc, None}},
    ScalingFunctions -> {Automatic, "Reverse"}]

enter image description here

Any ideas?

$Version
"13.3.0 for Microsoft Windows (64-bit) (June 3, 2023)"
$\endgroup$
2
  • $\begingroup$ I don't get any errors on v12.2.0 on Win7-x64. $\endgroup$
    – Syed
    Commented Aug 16, 2023 at 16:41
  • $\begingroup$ @Syed I am using v13.3.0, I've edited the question. $\endgroup$
    – sam wolfe
    Commented Aug 16, 2023 at 16:43

1 Answer 1

3
$\begingroup$

I don't know why, but using tickFunc[##]& instead of tickFunc in setting FrameTicks eliminates the issue:

ListLinePlot[RandomReal[1, 10], Frame -> True, 
 FrameTicks -> {{tickFunc[##] &, None}, {tickFunc[##] &, None}}, 
 ScalingFunctions -> {Automatic, "Reverse"}]

enter image description here

Alternatively, define the tick function as

tickFunc2 = MapAt[Reverse, {All, 3}]@
    Charting`ScaledTicks[{Identity, Identity}, 
      "TicksLength" -> {.01, .005}][##] &;

ListLinePlot[RandomReal[1, 10], Frame -> True, 
 FrameTicks -> {{tickFunc2, None}, {tickFunc2, None}}, 
 ScalingFunctions -> {Automatic, "Reverse"}]

enter image description here

$Version
"13.3.0 for Linux x86 (64-bit) (June 3, 2023)"
$\endgroup$
1
  • $\begingroup$ Interesting! I am also not sure why that happens. Thanks. $\endgroup$
    – sam wolfe
    Commented Aug 16, 2023 at 16:45

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.