0
$\begingroup$

I'm having trouble customizing the ticks on a 2D plot.

I currently have:

Plot[{1/8(4-4x/(5.2917721067*10^(-11))-x^2/(5.2917721067*10^(-11)^2))\
e^(-x/5.2917721067*10^(-11))}, {x,0,15*5.2917721067*10^(-11)}]

I want to customize the ticks such that it shows a tick at every interval of a0 = 5.2917721067*10^(-11) (hence the 0 -> 15*a0).

However, when I try to do:

Plot[{1/8(4-4x/(5.2917721067*10^(-11))-x^2/(5.2917721067*10^(-11)^2))\
e^(-x/5.2917721067*10^(-11))}, {x,0,5.2917721067*10^(-11)}, Ticks -> 
{{5.2917721067*10^(-11), a0}, {2*5.2917721067*10^(-11), 2a0}...}]

It fails to even plot the correct graph; it attempts to plot a straight line defined by:

Plot 5.2917721067

Is there something I'm missing?

$\endgroup$
3
$\begingroup$

You had a number of syntax mistakes in the function you were plotting. Here's what I'd do in this case:

a0 = QuantityMagnitude[UnitConvert[Quantity[1, "BohrRadius"]]];
Plot[1/8 (4 - 4 x/a0 - (x/a0)^2) Exp[-x/a0], {x, 0, 15 a0}, 
     Ticks -> {Table[{k a0, Style[If[k > 1, Row[{k, Subscript[a, 0]}], Subscript[a, 0]],
                                  Small]},
                     {k, 0, 15}], Automatic}]

plot

$\endgroup$
  • $\begingroup$ Thank you very much. I'm new to mathematica and this is a ton of help. $\endgroup$ – John May 20 '17 at 8:39

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.