1
$\begingroup$

Consider the following plot:

Plot[x, {x, 1, 10}, Frame -> True]

enter image description here

How can the plot be inverted in the y axis such that the x axis ticks and label will remain on top, for example

enter image description here

There are two posts with similar questions, but they do not keep the x axis on top and seem to not use Mathematica's abilities to their full extent so I did not find them useful:

$\endgroup$
3
$\begingroup$
Plot[x, {x, 1, 10}, Frame -> True, Axes -> False, 
 ScalingFunctions -> "Reverse", 
 FrameTicks -> {{Automatic, Automatic}, {Automatic, All}}, 
 FrameTicksStyle -> {{Automatic, Automatic},
                     {Directive[FontOpacity -> 0, FontSize -> 0], Automatic}},
 FrameLabel -> {{"y", None}, {None, "x"}}]

or

Plot[x, {x, 1, 10}, Frame -> True, Axes -> False, 
 ScalingFunctions -> "Reverse", 
 FrameTicks -> {{Automatic, Automatic}, {Automatic, All}}, 
 ImagePadding -> {{Automatic, Automatic}, {1, Automatic}},
 FrameLabel -> {{"y", None}, {None, "x"}}]

enter image description here

$\endgroup$
  • $\begingroup$ The frame label of the x axis appears below in the first suggestion, and don't appear at all in the second when adding FrameLabel->{"x","y"}. Can you address that in your answer? $\endgroup$ – jarhead May 5 '18 at 16:04
  • $\begingroup$ See the edited answer. $\endgroup$ – corey979 May 5 '18 at 17:46
1
$\begingroup$

You can use the internal functions Charting`ScaledTicks and Charting`ScaledFrameTicks to draw ticks with or without labels:

Plot[
    x,
    {x, 1, 10},
    Frame -> True, 
    ScalingFunctions->"Reverse",
    FrameTicks -> {
        {Automatic, Automatic},
        {
            Charting`ScaledFrameTicks[{Identity,Identity}], 
            Charting`ScaledTicks[{Identity,Identity}]
        }
    }
]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.