9
$\begingroup$

Charting`ScaledTicks was a convenient way to organize Ticks or Frameticks in Mathematica without needing to define a tick-function. Basically most tick-related questions here were answered with this undocumented command. This command is not working anymore in Mathematica 13.

Here is an easy example how it was used:

ListPlot[{{1, 1}, {2, 2}}, PlotRange -> {{0, 2.2}, {0, 2.2}}, 
 Frame -> True, 
 FrameTicks -> {{Charting`ScaledTicks["Linear"][0, 2.2, {5, 5}], 
    Charting`ScaledTicks["Linear"][0, 
     2.2, {5, 5}]}, {Charting`ScaledTicks["Linear"][0, 2.2, {5, 5}], 
    Charting`ScaledTicks["Linear"][0, 2.2, {5, 5}]}}, 
 FrameTicksStyle -> {{Black, 
    Directive[Black, FontOpacity -> 0, FontSize -> 0]}, {Black, 
    Directive[Black, FontOpacity -> 0, FontSize -> 0]}}]

Now I want to define my own tick-function. In the documentation you can define the position, label and length of a certain tick with:

{{x,label,length,...}

Is there also a way to just differentiate between a standard major and a minor tick (like in Automatic), instead of using length? Or do you know the standard-size of a major and minor tick in Mathematica, because I can't find it anywhere.

$\endgroup$
5
  • 1
    $\begingroup$ What do you mean that it “does not work anymore”? Please, it is essential to be specific and include the errors you get instead of such general statements. Can you, please, clarify? $\endgroup$ Commented Jun 3, 2022 at 12:31
  • $\begingroup$ With "does not work anymore" I mean that this command is apparently not supported anymore. The command Charting`ScaledTicks is now treated as an undefined input, resulting in the error message "A ticks specification in the value of FrameTicks should be None, Automatic, a function, or a list of ticks." The same command in Mathematica 12.1 gives the correct result. $\endgroup$ Commented Jun 3, 2022 at 13:17
  • 2
    $\begingroup$ The command seems to be still there. I tried running ?Charting`ScaledTicks on the Cloud, which is running version 13+. The syntax may have changed, since it is an undocumented function after all. Your best bet to recover your lost functionality would be to clear the Protected and ReadProtected attributes from it and then read its definitions to figure out a new syntax if necessary. Start from ClearAttributes[Charting`ScaledTicks, {Protected, ReadProtected}]; Definition[Charting`ScaledTicks]. $\endgroup$
    – MarcoB
    Commented Jun 3, 2022 at 14:24
  • 4
    $\begingroup$ It looks like this internal, undocumented function has been greatly modified. Try using Charting`ScaledTicks["Linear", {Identity, Identity}, "Standard"][0, 2.2, {5, 5}] instead. $\endgroup$
    – Carl Woll
    Commented Jun 3, 2022 at 16:26
  • 2
    $\begingroup$ OP, thanks for bringing this to the attention of the (mma.SE) community! I’ll have to see how badly this change impacts my uses of the Charting undocumented functions. $\endgroup$ Commented Jun 4, 2022 at 1:37

1 Answer 1

10
$\begingroup$

Add a second argument, "Nice" or "Standard" (V13.0.1):

ListPlot[{{1, 1}, {2, 2}}, PlotRange -> {{0, 2.2}, {0, 2.2}},
 Frame -> True, FrameTicks -> {
   {Charting`ScaledTicks["Linear", "Nice"][0, 2.2, {5, 5}],
    Charting`ScaledTicks["Linear", "Standard"][0, 
     2.2, {5, 5}]}, {Charting`ScaledTicks["Linear", "Nice"][0, 
     2.2, {5, 5}],
    Charting`ScaledTicks["Linear", "Standard"][0, 2.2, {5, 5}]}},
 FrameTicksStyle -> {{Black, 
    Directive[Black, FontOpacity -> 0, FontSize -> 0]}, {Black, 
    Directive[Black, FontOpacity -> 0, FontSize -> 0]}}]

enter image description here

$\endgroup$

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.