As it is common to most of us, when we plot a figure, x label ticks are located above x-axis and y label ticks are located at the right of y-axis. Is there any simple way to alter this in Mathematica? I am more interested in y-axis labels (numbers) because they overlap with the graph content. I would be happy to see them at the right side of the y-axis. Have any idea? Thanks in advance.enter image description here

Below is an example. If I move the axis origin to $(0,0)$, then the numbers overlap with the figure. I need to flip both the ticks and the numbers.

  • $\begingroup$ something like Plot[Cos[x], {x, 0, 10}, Ticks -> {{{Pi, 180 \[Degree], {0, .03}}, {2 Pi, 360 \[Degree], {0, .03}}, {3 Pi, 540 \[Degree], {0, .03}}}, {#, #, {0., .02}} & /@ Range[-1, 1, .2]}]? $\endgroup$
    – kglr
    Nov 4, 2014 at 23:04
  • $\begingroup$ @kguler in princip yes but I also need the numbers to be flipped as the ticks. Namely, if the y-axis ticks are looking to the left then the numbers should be at right. $\endgroup$ Nov 5, 2014 at 0:15
  • 1
    $\begingroup$ Possible duplicates: (2601), (6395), (42209). (Sadly there is no satisfying answer that I am aware of.) $\endgroup$
    – Mr.Wizard
    Nov 5, 2014 at 0:32
  • $\begingroup$ @Mr.Wizard I checked the asked questions especially this one : mathematica.stackexchange.com/questions/6395/… but I was not able to manipulate the answers to get an answer and I believe that it can be more useful it there could be some more practical answer, although I doubt there can be, because it seems a non trival thing. $\endgroup$ Nov 5, 2014 at 0:36
  • $\begingroup$ Although there is one trick you might use, which I shall attempt in a minute, I fear that you may need to draw your own ticks entirely. For an example of what is involved see this: (23910) $\endgroup$
    – Mr.Wizard
    Nov 5, 2014 at 0:39

2 Answers 2


Post-processing the FullGraphics of Plot output to change the positions of ticks and tick labels of the vertical axis:

Graphics[Replace[First[FullGraphics[plt1 = Plot[Sin[x], {x, 0, 10}]]],
  {Text[a_, b_, {1., 0.}] :> Text[Pane[a, 30, Alignment -> Left], b, -{2, 0}],
   Line[{{0., b_ /; b != 0}, {c_, b_}}] :> Line[{{0., b}, {-3 c, b}}]}, {0, Infinity}],
   ImageSize -> 500, plt1[[2]][[1]]]

enter image description here

  • $\begingroup$ Is it possible to have exactly the same style (the number of ticks, the outlook and the number of numbers (-1,-0.5,0,0.5,1 in this example)) of the ticks of the original figure. $\endgroup$ Nov 5, 2014 at 1:48
  • 2
    $\begingroup$ Sadly this no longer works in version 10 as FullGraphics is broken. This was the first thing I tried. $\endgroup$
    – Mr.Wizard
    Nov 5, 2014 at 1:58
  • $\begingroup$ @Mr.Wizard & seyhmus, this has some glitches in V9 too; FullGraphics[plt1] "should" display the same as plt1 but it doesn't; it changes the ticks. I am afraid creating ticks and labels separately (that is, not relying on post-processing) seems to be the only way to go. $\endgroup$
    – kglr
    Nov 5, 2014 at 9:00

Well, if the elegant method of kguler does not work in Mma 10, one can draw everything "by hand":

     lst1 = Join[Table[Line[{{-0.05, 0.1 i}, {0, 0.1 i}}], {i, -10, 10, 1}], 
   Table[Line[{{-0.08, 0.5 i}, {0, 0.5 i}}], {i, -2, 2, 1}]];
lst2 = Table[Text[Style[0.5 i, 12, Italic], {-0.3, 0.5 i}], {i, -2, 2, 1}];
lst3 = Table[Line[{{\[Pi]*i/2, -0.05}, {\[Pi]*i/2, 0}}], {i, 1, 4, 1}];
lst4 = Table[Text[Style[\[Pi]*i/2, 12, Italic], {\[Pi]*i/2, -0.3}], {i, 1, 4,1}];

  Plot[Sin[x], {x, 0, 2 \[Pi]}, Ticks -> None, 
   PlotRange -> {{-0.5, 2 \[Pi]+0.5}, Automatic}],
  Graphics[{lst1, lst3}],
  Graphics[{lst2, lst4}]

yielding this: enter image description here

Have fun!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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