5
$\begingroup$

I have the following code

plot = ListPlot3D[mydata5, DataRange -> {{0, 6}, {0, 6}}, PerformanceGoal -> "Quality", 
                 BoxRatios -> {1, 1, .7}, 
                 AxesLabel -> {Style[Subscript[t, l], FontSize -> 21], 
                   Style[Subscript[t, u], FontSize -> 21], 
                   Style[Subsuperscript[Subscript["E", Subscript[N, 0]], m, a]/
                         Subsuperscript[Subscript["E", Subscript[N, 0]], m, m], FontSize -> 21]}, 
                 BaseStyle -> 18]

For plotting a 3D $60\times 60$ data. Here is the outputenter image description here

Obviously the problem is at the axes label at left up side. It overlaps with the numbers. I am just using rotate sign and do the rotation and scaling manually. This view was the nicest view but I cannot play with increasing or decreasing the indent of the axeslabels. Is it possible to add it inside ListPlot3D?

I am sorry, but I dont know how to load the data here but I think it might not be a crucial issue.

EDIT:(29.10.2014)

I checked the following questions and the answers therein:

Collision of axes labels and ticks

AxesLabel in Histogram3D unreadable

These answer also don't help me because they don't have Subscript notations in the Style, instead they have "".

$\endgroup$
1
  • $\begingroup$ Does anyone have any idea? thx. $\endgroup$ Commented Oct 29, 2014 at 20:41

3 Answers 3

4
$\begingroup$
ClearAll[pF];
pF[l_: 0, r_: 5] := Pane[Style[#, FontSize -> Large],FrameMargins -> {{l, r}, {0, 0}}] &;

{xl, yl, zl} = {Style[Subscript[t, l], FontSize -> 21], 
   Style[Subscript[t, u], FontSize -> 21], 
   Style[Subsuperscript[Subscript["E", Subscript[N, 0]], m, a]/
     Subsuperscript[Subscript["E", Subscript[N, 0]], m, m], 
    FontSize -> 21]};

mydata5 = Table[Sin[j^2 + i], {i, 0, Pi, Pi/5}, {j, 0, Pi, Pi/5}];
Row[ListPlot3D[mydata5, DataRange -> {{0, 6}, {0, 6}}, BaseStyle -> 18,
    PerformanceGoal -> "Quality", ImageSize -> 300, BoxRatios -> {1, 1, .7}, 
    AxesLabel -> {xl, yl, pF[0, #]@zl} ] & /@ {0, 20, 40}, Spacer[10]]

enter image description here

You can also use Framed instead of Pane:

ClearAll[pF2];
pF2[l_: 0, r_: 5] := Framed[Style[#, FontSize -> Large], FrameStyle->None,
                     FrameMargins -> {{l, r}, {0, 0}}] &;
$\endgroup$
2
  • $\begingroup$ woow! thats working really great. Once again thank you very much for your help. I was really struggling for a very easy looking problem, which turned out to be really non-trivial. I also find it strange because this is really something basic and mathematica shouldnt have such a problem. $\endgroup$ Commented Oct 29, 2014 at 21:43
  • $\begingroup$ seyhmus, thanks for the Accept. $\endgroup$
    – kglr
    Commented Oct 29, 2014 at 22:05
1
$\begingroup$

A quick fix is to add several white spaces i.e. use something like AxesLabel -> "a ". You can use Manipulate to adjust the number of white spaces:

With[{p = Plot3D[Abs[x + I y], {x, -4, 4}, {y, -4, 4}]}, 
 Manipulate[Show[p, AxesLabel -> "|z|" <> ConstantArray[" ", n]], {n, 0, 10, 1}]]

enter image description here


As suggested by Alexey Popkov in the comment below, we can achieve exact positioning with Spacers:

With[{p = Plot3D[Abs[x + I y], {x, -4, 4}, {y, -4, 4}]}, 
 Manipulate[Show[p, AxesLabel -> Row[{"|z|", Spacer[s]}]], {s, 0, 100}]]
$\endgroup$
5
  • 1
    $\begingroup$ Instead of ConstantArray[" ", n] you could use Spacer[w] for exact positioning. $\endgroup$ Commented Oct 28, 2014 at 7:28
  • $\begingroup$ @AlexeyPopkov Oh, I didn't know this function! Added. $\endgroup$
    – xzczd
    Commented Oct 28, 2014 at 8:11
  • $\begingroup$ I have a problem with spacer. It is spacing not only $z$ axis but also $x$ and $y$ axeses, which must normally not happen. $\endgroup$ Commented Oct 28, 2014 at 16:07
  • $\begingroup$ I have checked in v.8.0.4 and v.10.0.1: with Spacer the behavior is exactly as shown in the animation, but more smooth. $\endgroup$ Commented Oct 30, 2014 at 5:25
  • $\begingroup$ @SeyhmusGüngören Sorry, I can't understand what you mean, I just checked my approach with kguler's data, the behavior is exactly the same at least in my computer. Can you elaborate a little? $\endgroup$
    – xzczd
    Commented Nov 1, 2014 at 3:01
1
$\begingroup$
Plot3D[29000.0 Abs[x + I y], {x, -4, 4}, {y, -4, 4},
 BoxRatios -> {1, 1, .7},
 ImageSize -> 300,
 AxesLabel -> Row[{Spacer[30], 
    Style[ Subsuperscript[Subscript["E", Subscript[N, 0]], m, a]/Subsuperscript[
    Subscript["E", Subscript[N, 0]], m, m]], Spacer[30]}]
]

Blockquote

$\endgroup$
3
  • $\begingroup$ You can in the Row use the Spacer . Like this: `Row[{Style[ Subsuperscript[Subscript["E", Subscript[N, 0]], m, a]/ Subsuperscript[Subscript["E", Subscript[N, 0]], m, m]], Spacer[30]}]] $\endgroup$ Commented Oct 28, 2014 at 8:17
  • $\begingroup$ @Alexei Boulbitch Thanks :) $\endgroup$
    – Junho Lee
    Commented Oct 28, 2014 at 8:41
  • $\begingroup$ $z$ axis is okay but $x$ and $y$ are also spaced, which is not desired. Do you have any idea to apply it only to the $z$ axis? $\endgroup$ Commented Oct 28, 2014 at 16:05

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.