14
$\begingroup$

Bug introduced in 12.3 and persists in 13.0


Is this a bug of AxisObjec? Or I have misunderstood the usage?

My understanding is that by setting the option TickLabels to TickLabels -> {All, All} will give tick labels to both the major and minor ticks. However, currently it only gives labels to the major ticks.

Graphics[
 AxisObject[Line[{{0, 0}, {10, 10}}], {0, 10}, 
  TickPositions -> {{0, 10, 2}, {1, 9, 2}}, 
  TickLabels -> {All, All}]]
$\endgroup$
1
  • $\begingroup$ Re the tag bugs: "This tag will be added to questions about problems that have subsequently been confirmed by other users to be caused by bugs in Mathematica. It should not be used when asking new questions. If you know that a certain behavior is a confirmed bug, please report it to Wolfram Support instead (or e-mail [email protected])." $\endgroup$
    – Michael E2
    Jan 12, 2022 at 2:05

3 Answers 3

11
$\begingroup$

It looks like this is a bug to me. Based on david's comment and Michael's answer, we see:

TracePrint[
    ToBoxes @ Graphics[
        AxisObject[
            Line[{{0, 0}, {10, 10}}], 
            {0, 10}, 
            TickPositions -> {{0, 10, 2}, {1, 9, 2}}, 
            TickLabels -> {All, All}
        ]
    ],
    _System`Dump`formatTickLabelSet,
    TraceInternal -> True
]

            System`Dump`formatTickLabelSet[All,StandardForm]

            System`Dump`formatTickLabelSet[All,StandardForm]

GraphicsBox[ AxisBox[LineBox[{{0, 0}, {10, 10}}], {0, 10}, TickLabels -> {Automatic, Automatic}, TickPositions -> {{0, 10, 2}, {1, 9, 2}}]]

As Michael says, note that the TickLabels option has been changed from {All, All} to {Automatic, Automatic}.

Now, the DownValues for System`Dump`formatTickLabelSet are:

Block[{Internal`$ContextMarks = False},
    Print @ Column @ DownValues @ System`Dump`formatTickLabelSet
]

HoldPattern[formatTickLabelSet[Automatic,fmt_]]:>Automatic HoldPattern[formatTickLabelSet[None|False,fmt_]]:>None HoldPattern[formatTickLabelSet[All|True,fmt_]]:>Automatic HoldPattern[formatTickLabelSet[ticklabels_List,fmt_]]:>(LabelToBoxes[#1,fmt,Automatic]&)/@ticklabels

Notice that All gets sent to Automatic. This looks like a bug to me. One possibility is to do:

System`Dump`formatTickLabelSet[All, _] := All

Then:

ToBoxes @ Graphics[
    AxisObject[
        Line[{{0, 0}, {10, 10}}], 
        {0, 10}, 
        TickPositions -> {{0, 10, 2}, {1, 9, 2}}, 
        TickLabels -> {All, All}
    ]
]

GraphicsBox[ AxisBox[LineBox[{{0, 0}, {10, 10}}], {0, 10}, TickLabels -> {All, All}, TickPositions -> {{0, 10, 2}, {1, 9, 2}}]]

And this renders correctly:

RawBoxes @ %

enter image description here

$\endgroup$
9
$\begingroup$

On my Mac, @kglr's fix shows an error that can be fixed by executing the menu command Cell > Show Expression twice after selecting the output cell.

Here is another way to fix the problem, which is that the TickLabels option as created by MakeBoxes[] is TickLabels -> {Automatic, Automatic} instead of TickLabels -> {All, All}:

Graphics[
 AxisObject[Line[{{0, 0}, {10, 10}}], {0, 10}, 
  TickPositions -> {{0, 10, 2}, {1, 9, 2}}, 
  TickLabels -> {All, All}]]
NotebookWrite[NextCell[],
 NotebookRead[NextCell[]] /. 
  HoldPattern[TickLabels -> _] :> TickLabels -> {All, All}
 ]
$\endgroup$
6
$\begingroup$

A work-around: use TickLabels -> Full (or TickLabels -> {All, Full})

Graphics @ AxisObject[Line[{{0, 0}, {10, 10}}], {0, 10}, 
    TickPositions -> {{0, 10, 2}, {1, 9, 2}}, 
    TickLengths -> {.5, .3}, 
    TickLabelPositioning -> {"Base", "Tip"}, 
    TickLabels -> Full]

enter image description here

$Version

"13.0.0 for Linux x86 (64-bit) (November 22, 2021)"

$\endgroup$
5
  • $\begingroup$ This does not work on Version 13.0 $\endgroup$ Jan 11, 2022 at 23:14
  • $\begingroup$ @bakerryd123, It works on version 13.0 on wolfram cloud. $\endgroup$
    – kglr
    Jan 11, 2022 at 23:32
  • 2
    $\begingroup$ This correctly displays the graphics, but with a red box and generates a Message, "The TickLabels->Dump`formatTickLabels[Full, StandardForm] specification does not correspond to the given TickPositions." However, when I click the graphic, then outside the graphic a couple of times, the red box disappears. Win 10 Home, version 13.0. $\endgroup$
    – david
    Jan 12, 2022 at 2:00
  • $\begingroup$ Has anyone experiencing this specific error reported this to Wolfram Support? If not, can you, please, do this? Thanks! $\endgroup$ Jan 12, 2022 at 2:05
  • 1
    $\begingroup$ @CATrevillian I have already reported the bug to WR $\endgroup$ Jan 12, 2022 at 22:20

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.