I need to change the position of my axes labels such that the y-axis label is in the middle and parallel to the y-axis. I'd also like the x-axis label to be in the middle of the x-axis rather than pushed to the far right. I've read a few posts on this topic (related_post1, related_post2) but they all don't seem to help in this instance. This is slightly complicated by the fact that I deliberately want my x-axis at the top rather than at the bottom. I really don't want to frame the plot in this case but if I really have to, how do I move the x-axis to the top of the frame rather than at the bottom?

Below is my code:

Plot[-x^2 - 4, {x, 0, 5}, ImageSize -> 500, AxesOrigin -> {0, -1}, 
AxesLabel -> {"x-axis", "y-axis"} ]

Any assistance would be highly appreciated.

  • 1
    $\begingroup$ Labeled[Plot[-x^2 - 4, {x, 0, 5}, ImageSize -> 500, AxesOrigin -> {0, -1}], {"Y axis", "X Axis"}, {Left, Top}] ? $\endgroup$ Jul 2, 2015 at 16:42
  • $\begingroup$ Thanks for your post. The only little thing is that my y-axis label is actually meant to be parallel to the y-axis-I shall edit my post to include this. Any ideas? $\endgroup$
    – John_dydx
    Jul 2, 2015 at 16:49
  • $\begingroup$ I believe it's important to point out that there seems to be no way to place AxesLabel labels. The docs for AxesLabel teasingly say "By default, axes labels in two-dimensional graphics are placed at the ends of the axes ", implying that they can be moved. But I've not found that to be the case. Use FrameLabel labels, or Labeled labels, as the fine answers suggest. $\endgroup$ Jul 8, 2017 at 3:23

2 Answers 2


If your objection to framing the plot is that you don't want the full frame box, you can get around that by specifying specific directives for each side in Frame and the related options:

Plot[-x^2 - 4, {x, 0, 5},
 ImageSize -> 500,
 Axes -> False,
 Frame -> {{True, False}, {False, True}},
 FrameLabel -> {{"y-axis", None}, {None, "x-axis"}},
 FrameTicks -> All]


  • $\begingroup$ This is great, thanks. $\endgroup$
    – John_dydx
    Jul 2, 2015 at 16:51
  • $\begingroup$ You can use the shorter FrameTicks -> All with the same effect. $\endgroup$
    – Mr.Wizard
    Jul 3, 2015 at 1:52
  • $\begingroup$ @Mr.Wizard, thanks for the tip! $\endgroup$
    – Virgil
    Jul 3, 2015 at 17:05
  • $\begingroup$ ContourPlot[2/(1/P + 1/R), {P, 0, 1}, {R, 0, 1}, PlotLegends -> Automatic, FrameLabel -> {{"P", None}, {"R", None}}] $$~$$ Labeled[ContourPlot[2/(1/P + 1/R), {P, 0, 1}, {R, 0, 1}, PlotLegends -> Automatic], {"P", "R"}, {Left, Bottom}] $\endgroup$
    – Nick Dong
    Oct 14, 2019 at 13:30
Labeled[Plot[-x^2 - 4, {x, 0, 5}, ImageSize -> 500,  AxesOrigin -> {0, -1}],
        {"Y axis", "X Axis"}, {Left, Top}, RotateLabel -> True]

Mathematica graphics

  • $\begingroup$ This answer is definitely a lot simpler to understand codewise. Thanks! $\endgroup$
    – John_dydx
    Jul 2, 2015 at 17:00
  • $\begingroup$ This a great answer. Is it possible to adjust the distance between the labels and the axes? For example, if I want the "X Axis" to be closer to the axis at the top in your picture, how to do that? $\endgroup$
    – nanjun
    Jan 23, 2017 at 21:03
  • $\begingroup$ @nanjun use the option Spacings -> {0.1,0.1} . The spacings can be positive or negative. $\endgroup$ Jan 18, 2020 at 15:35

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.