2
$\begingroup$

I want to move the two horizontal axes closer to the axes keeping the same writing style (the label parallel to the axis), and also, the vertical axis should be parallel to the vertical label. Does anyone know how I can achieve that?


f7[n1_, l1_, m1_, a1_, n2_, l2_, m2_, a2_, q_] := 
 Module[{m = 0, n = n1 - l1 - 1, 
   del = ((a2/a1*n2) + (a1*n1))/(n1*a2*n2), 
   gamma = l1 + l2 + k1 + 3/2, beta = 2/(a1*n1), mu = q, 
   alpha = 2*l1 + 1, nu = l + 1/2},
  N1 = 4*\[Pi]*2/(
    a1^(3/2)*n1^2)*2/((a2/a1)^(3/2)*
     n2^2)*\[Sqrt]((n1 - l1 - 1)!/(n1 + l1)!*(n2 - l2 - 1)!/(n2 + 
          l2)!)*(2/(a1*n1))^l1*(2/(a2/a1*n2))^l2*\[Sqrt](\[Pi]/(2*q))*
    KroneckerDelta[m, 0];
  Il = Sum[(n2 + l2)!*((-1)^k1 2^k1*(-beta)^k*mu^nu*
      Gamma[n + alpha + 1])/(
     k1!*(n2 - l2 - 1 - k1)!*(2*l2 + k1 + 1)!*(a2/a1)^k1*n2^
      k1)*(Gamma[
        nu + gamma + k + 1]/(Gamma[k + 1]*Gamma[n - k + 1]*
         Gamma[alpha + k + 1]*2^nu*Gamma[nu + 1]*
         del^(nu + gamma + k + 1)))*
     Hypergeometric2F1[(nu + gamma + k + 1)/2, (nu + gamma + k + 2)/2,
       1 + nu, -mu^2/del^2], {k, 0, n}, {k1, 0, n2 - l2 - 1}]; 
  Al = I^l*\[Sqrt]((2*l + 1)/(4*\[Pi]))*
    ThreeJSymbol[{l1, 0}, {l2, 0}, {l, 0}]*
    ThreeJSymbol[{l1, 
      m1}, {l2, -m2}, {l, -m}]*(-1)^(m2 + 
       m)*\[Sqrt](((2*l1 + 1)*(2*l2 + 1)*(2*l + 1))/(4*\[Pi]));
  
  temp1 = Sum[N1*Al*Il, {l, Abs[l1 - l2], l1 + l2}];
  {temp1} // N
  ]

Show[Plot3D[f7[4, 2, 0, 1, 5, 0, 0, a, q], {a, 1, 5}, {q, 0, .6}, 
  PlotRange -> Full, Background -> White, 
  Lighting -> {{"Ambient", White}}, 
  ColorFunction -> Function[{a, q, z}, White], PlotRange -> Full, 
  ImageSize -> Large, LabelStyle -> Black, BoxStyle -> Black, 
  TicksStyle -> Black, AxesStyle -> Black],  
 AxesLabel -> {Rotate["ratio of Bohr radii \[Rho] ", -20 Degree, 
    Black], Rotate["transferred momentum\n q in atomic unit
", 60 Degree], Rotate["form factor ", 90 Degree]}]

This is the output

$\endgroup$

1 Answer 1

6
$\begingroup$
Clear["Global`*"]

f7[n1_, l1_, m1_, a1_, n2_, l2_, m2_, a2_, q_] :=
 Module[
  {m = 0, n = n1 - l1 - 1, del = ((a2/a1*n2) + (a1*n1))/(n1*a2*n2), 
   gamma = l1 + l2 + k1 + 3/2, beta = 2/(a1*n1), mu = q, alpha = 2*l1 + 1, 
   nu = l + 1/2},
  N1 = 4*π*2/(a1^(3/2)*n1^2)*2/((a2/a1)^(3/2)*
       n2^2)*√((n1 - l1 - 1)!/(n1 + l1)!*(n2 - l2 - 1)!/(n2 + 
           l2)!)*(2/(a1*n1))^l1*(2/(a2/a1*n2))^l2*√(π/(2*q))*
    KroneckerDelta[m, 0];
  Il = Sum[(n2 + l2)!*((-1)^k1 2^k1*(-beta)^k*mu^nu*
        Gamma[n + alpha + 
          1])/(k1!*(n2 - l2 - 1 - k1)!*(2*l2 + k1 + 1)!*(a2/a1)^k1*
        n2^k1)*(Gamma[
        nu + gamma + k + 1]/(Gamma[k + 1]*Gamma[n - k + 1]*
         Gamma[alpha + k + 1]*2^nu*Gamma[nu + 1]*del^(nu + gamma + k + 1)))*
     Hypergeometric2F1[(nu + gamma + k + 1)/2, (nu + gamma + k + 2)/2, 
      1 + nu, -mu^2/del^2], {k, 0, n}, {k1, 0, n2 - l2 - 1}];
  Al = I^l*√((2*l + 1)/(4*π))*
    ThreeJSymbol[{l1, 0}, {l2, 0}, {l, 0}]*
    ThreeJSymbol[{l1, 
      m1}, {l2, -m2}, {l, -m}]*(-1)^(m2 + 
       m)*√(((2*l1 + 1)*(2*l2 + 1)*(2*l + 1))/(4*π));
  temp1 = Sum[N1*Al*Il, {l, Abs[l1 - l2], l1 + l2}] // N]

Labels:

lbls = {
   Rotate["ratio of Bohr radii ρ", -20 Degree],
   Rotate["transferred momentum\n q in atomic unit", 60 Degree],
   Rotate["form factor\n\n", 95 Degree]};

Evaluate the argument to Plot3D

plt = Plot3D[
   Evaluate@f7[4, 2, 0, 1, 5, 0, 0, a, q],
   {a, 1, 5}, {q, 0, .6},
   PlotRange -> Full,
   Background -> White,
   Lighting -> {{"Ambient", White}},
   ColorFunction -> Function[{a, q, z}, White],
   PlotRange -> Full,
   ImageSize -> Large,
   LabelStyle -> Black,
   BoxStyle -> Black,
   TicksStyle -> Black,
   AxesStyle -> Black];

EDIT: For earlier versions with which AbsoluteOptions does not provide explicit ticks, use the output of

ticks = AbsoluteOptions[plt, Ticks][[1, -1]]

(* {{{1., "1", {0.00329516, 0.}}, {1.2, "", {0.0019771, 0.}}, {1.4, 
   "", {0.0019771, 0.}}, {1.6, "", {0.0019771, 0.}}, {1.8, 
   "", {0.0019771, 0.}}, {2., "2", {0.00329516, 0.}}, {2.2, 
   "", {0.0019771, 0.}}, {2.4, "", {0.0019771, 0.}}, {2.6, 
   "", {0.0019771, 0.}}, {2.8, "", {0.0019771, 0.}}, {3., 
   "3", {0.00329516, 0.}}, {3.2, "", {0.0019771, 0.}}, {3.4, 
   "", {0.0019771, 0.}}, {3.6, "", {0.0019771, 0.}}, {3.8, 
   "", {0.0019771, 0.}}, {4., "4", {0.00329516, 0.}}, {4.2, 
   "", {0.0019771, 0.}}, {4.4, "", {0.0019771, 0.}}, {4.6, 
   "", {0.0019771, 0.}}, {4.8, "", {0.0019771, 0.}}, {5., 
   "5", {0.00329516, 0.}}}, {{0., "0.0", {0.0040624, 0.}}, {0.02, 
   "", {0.00243744, 0.}}, {0.04, "", {0.00243744, 0.}}, {0.06, 
   "", {0.00243744, 0.}}, {0.08, "", {0.00243744, 0.}}, {0.1, 
   "0.1", {0.0040624, 0.}}, {0.12, "", {0.00243744, 0.}}, {0.14, 
   "", {0.00243744, 0.}}, {0.16, "", {0.00243744, 0.}}, {0.18, 
   "", {0.00243744, 0.}}, {0.2, "0.2", {0.0040624, 0.}}, {0.22, 
   "", {0.00243744, 0.}}, {0.24, "", {0.00243744, 0.}}, {0.26, 
   "", {0.00243744, 0.}}, {0.28, "", {0.00243744, 0.}}, {0.3, 
   "0.3", {0.0040624, 0.}}, {0.32, "", {0.00243744, 0.}}, {0.34, 
   "", {0.00243744, 0.}}, {0.36, "", {0.00243744, 0.}}, {0.38, 
   "", {0.00243744, 0.}}, {0.4, "0.4", {0.0040624, 0.}}, {0.42, 
   "", {0.00243744, 0.}}, {0.44, "", {0.00243744, 0.}}, {0.46, 
   "", {0.00243744, 0.}}, {0.48, "", {0.00243744, 0.}}, {0.5, 
   "0.5", {0.0040624, 0.}}, {0.52, "", {0.00243744, 0.}}, {0.54, 
   "", {0.00243744, 0.}}, {0.56, "", {0.00243744, 0.}}, {0.58, 
   "", {0.00243744, 0.}}, {0.6, "0.6", {0.0040624, 0.}}}, {{-0.22, 
   "", {0.00243744, 0.}}, {-0.21, "", {0.00243744, 0.}}, {-0.2, 
   "-0.20", {0.0040624, 0.}}, {-0.19, "", {0.00243744, 0.}}, {-0.18, 
   "", {0.00243744, 0.}}, {-0.17, "", {0.00243744, 0.}}, {-0.16, 
   "", {0.00243744, 0.}}, {-0.15, "-0.15", {0.0040624, 0.}}, {-0.14, 
   "", {0.00243744, 0.}}, {-0.13, "", {0.00243744, 0.}}, {-0.12, 
   "", {0.00243744, 0.}}, {-0.11, "", {0.00243744, 0.}}, {-0.1, 
   "-0.10", {0.0040624, 0.}}, {-0.09, "", {0.00243744, 0.}}, {-0.08, 
   "", {0.00243744, 0.}}, {-0.07, "", {0.00243744, 0.}}, {-0.06, 
   "", {0.00243744, 0.}}, {-0.05, "-0.05", {0.0040624, 0.}}, {-0.04, 
   "", {0.00243744, 0.}}, {-0.03, "", {0.00243744, 0.}}, {-0.02, 
   "", {0.00243744, 0.}}, {-0.01, "", {0.00243744, 0.}}, {0., 
   "0.00", {0.0040624, 0.}}, {0.01, "", {0.00243744, 0.}}, {0.02, 
   "", {0.00243744, 0.}}, {0.03, "", {0.00243744, 0.}}, {0.04, 
   "", {0.00243744, 0.}}, {0.05, "0.05", {0.0040624, 0.}}, {0.06, 
   "", {0.00243744, 0.}}, {0.07, "", {0.00243744, 0.}}, {0.08, 
   "", {0.00243744, 0.}}, {0.09, "", {0.00243744, 0.}}, {0.1, 
   "0.10", {0.0040624, 0.}}, {0.11, "", {0.00243744, 0.}}, {0.12, 
   "", {0.00243744, 0.}}, {0.13, "", {0.00243744, 0.}}, {0.14, 
   "", {0.00243744, 0.}}}}

Then,

ticks = ticks /.
   {{3.2, "", r___} :> {3.2, lbls[[1]], r}, 
    {0.28, "", r___} :> {0.28, lbls[[2]], r}, 
    {-0.06, "", r___} :> {-0.06, lbls[[3]], r}}; *)

Show[plt, Ticks -> ticks]

enter image description here

$\endgroup$
3
  • $\begingroup$ I copied your code and run it but the axes labels are disappeared now. In your fugure, it is showing as I want. I am not sure what I am missing. Is it related to version of Mathematica? I am using 12.2.0. @Bob Thank you so much for your reply. $\endgroup$ Aug 3 at 18:36
  • 1
    $\begingroup$ I used v13.1; prior to v13.0, it appears that AbsoluteOptions[plt, Ticks] evaluates to {Ticks -> {Automatic, Automatic, Automatic}} rather than including the actual ticks. You would need to specify all of the ticks in order to include the ticks used for axes labels. $\endgroup$
    – Bob Hanlon
    Aug 3 at 19:12
  • 1
    $\begingroup$ I could able to run the code in v13.1, and it is working. Thank you so much for your help. @Bob $\endgroup$ Aug 4 at 15:35

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.