Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

By default Mathematica places the x-axis labels at the end of the axes likeenter image description here

Googling has suggested a way around this is to use Frame- for example Frame -> {True, True, False, False}, FrameLabel -> {"E/T", None} which produces something like enter image description here

Which is not too bad, but I do not want this vertical dividing line x=0 and really would have preffered to keep the y-axis in the middle of the plot where this divider line now is. Can this be done? Is there a better way than this to move axes labels below?

share|improve this question
    
Question is related this question –  m_goldberg Jan 14 '13 at 16:55
add comment

2 Answers

up vote 10 down vote accepted

You are saying would have preffered to keep the y-axis in the middle of the plot where this divider line now is.

An easy way is to use Labeled with Plot since Plot keeps the y axis in the middle while Frame->True moves it to the left where you do not want it.

Labeled[Plot[Sin[x] x, {x, -3, 3}], "E/T"]

enter image description here

Labeled has many option to allow different placements and alignments and such, so it can actually be used instead of the plot labeling. The only thing to keep in mind, is that symbols used in inside the Plot, such as those used by PlotLabel are automatically set in TraditionalMode while those set by Labeled are not and you have to do that yourself if you want that typesetting. Compare the typesetting below on the labels:

Grid[{

  {Labeled[Plot[Sin[x] x, {x, -3, 3}, ImageSize -> 300],Sin[x]]},

  {Plot[Sin[x] x, {x, -3, 3},AxesLabel->{Sin[x],None},ImageSize->300]}

 }, Frame -> All
]

enter image description here

But this is easy to handle. Simply use TraditionalForm for `Labeled, like this

Clear[x];

Labeled[Plot[Sin[x] x, {x, -3, 3}, ImageSize -> 300], 

 Text@TraditionalForm@Style[Sin[x], 16]

]

enter image description here

edit To answer the comment about exporting;

I just saved the image using Save Selection as eps, and labels are there

enter image description here

I am on Linux, and Export in the version of Mahematica I am using is not supported. But it seems to save .eps just fine.

share|improve this answer
    
thanks, that works pretty well. I didn't mention in my OP but I actually have three plots that I usually show on the same axis using Show[plot1,plot2,plot3] -with your method if I do Show[ Labeled[Plot[Sin[x] x, {x, -3, 3}], "E/T"],Labeled[Plot[Cos[x] x, {x, -3, 3}], "E/T"]] for example then things don't seem to work. Is there a way to get around this? –  fpghost Jan 14 '13 at 12:14
    
Actually I see now that Labeled[Show[plot1, plot2, plot3], "E/T", LabelStyle -> Directive[20, Bold]] works fine. Thanks again. –  fpghost Jan 14 '13 at 12:18
    
If one then exports this figure as an eps say the axes labels do not seem to get exported too? –  fpghost Jan 14 '13 at 12:22
    
Sorry my mistake again- the problem was I was simply doing `Right-click>Export' rather than the command version which gave the desired behaviour. –  fpghost Jan 14 '13 at 12:46
add comment
  Plot[Sin[x] x, {x, -3, 3}, Frame -> {True, True, False, False}, 
   FrameLabel -> {"E/T", None}, Axes -> False]

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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