6
$\begingroup$

I have a plot and have applied options to customize the axis labels and ticks.

Plot3D[{(Bg*l2*l3), 0}, {l2, 0, 20}, {l3, 0, 20}, 
  AxesLabel -> 
    {Style[Subscript[λ, 2], "Text", Background -> White], 
     Style[Subscript[λ, 3], "Text", Background -> White], 
     Style[B[γ] Subscript[λ, 2] Subscript[λ, 3], "Text", Background -> White]}, 
  Ticks -> 
    {Automatic, Automatic, 
     {{-1000000, HoldForm[-10^6]}, 0, {1000000, HoldForm[10^6]}, 
      {2000000, HoldForm[2*10^6]}}}]

However, on the vertical axis the label obscures the numbers labeling the ticks. Is there a way to move it upwards so that it's above $2*10^6$?

enter image description here

$\endgroup$
7
$\begingroup$

I recommend you rotate the label on the vertical axis:

Plot3D[{Sin[x y], 2 x y},
 {x, -5, 5}, {y, -5, 5},
 AxesLabel -> {"this is x", "this is y", 
   Rotate[ Text[Style["this is z", 14]], \[Pi]/2]}]

enter image description here

and if you need more space, simply add line returns:

Plot3D[{Sin[x y], 2 x y},
 {x, -5, 5}, {y, -5, 5},
 AxesLabel -> {"this is x", "this is y", 
   Rotate[ Text[Style["this is z\n", 14]], \[Pi]/2]}]

enter image description here

Which of course works with subscripts:

Plot3D[{Sin[x y], 2 x y}, {x, -5, 5}, {y, -5, 5}, 
 AxesLabel -> {"this is x", "this is y", 
   Rotate[Text[
     Style["Here is \!\(\*SubscriptBox[\(text\), \(abc\)]\) with \!\(\
\*SubscriptBox[\(subscripts\), \(xy\)]\)\n", 14]], \[Pi]/2]}]

enter image description here

Or try this:

Plot3D[{Sin[x y], 2 x y}, {x, -5, 5}, {y, -5, 5}, 
 AxesLabel -> {"this is x", "this is y", 
   Rotate[Text[
     Style["Here is \!\(\*SubscriptBox[\(\[Lambda]\), \(abc\)]\) and \
\!\(\*SubscriptBox[\(\[Lambda]\), \(xy\)]\)\n", 14]], \[Pi]/2]}]
$\endgroup$
  • $\begingroup$ Thanks for your suggestion. However, the label is still on top of the numbers, since I have a long $2*10^6$. $\endgroup$ – Thomas Apr 30 '15 at 10:39
  • $\begingroup$ @LCF Please see my amended answer. $\endgroup$ – David G. Stork Apr 30 '15 at 10:46
  • $\begingroup$ Thanks. However, this does not work in my case since I have not a text but an expression with "Subscript[]" as axes labels. $\endgroup$ – Thomas Apr 30 '15 at 11:13
  • $\begingroup$ @LCF It is of course trivial to add subscripts, as you can see. $\endgroup$ – David G. Stork Apr 30 '15 at 11:21
  • $\begingroup$ Thanks, that solved my problem. $\endgroup$ – Thomas Apr 30 '15 at 11:32

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.