# Want logarithmic scale on the x-axis of a plot [closed]

I have succesfully plotted the running of the gauge couplings to one loop order with mathematica.

My code is as follows:

SMbetafunctions =
{g1'[t] == 1/(16*Pi^2)*(41/6)*g1[t]^3,
g2'[t] == 1/(16*Pi^2)*(-19/6)*g2[t]^3,
g3'[t] == 1/(16*Pi^2)*-7*g3[t]^3,
g1[0] == 0.35940,
g2[0] == 0.64754,
g3[0] == 1.1666};

sol = NDSolve[SMbetafunctions, {g1, g2, g3}, {t, 0, 50}];

Plot[Evaluate[{g1[t], g2[t], g3[t]} /. sol], {t, 0, 50},
PlotLegends -> {g1, g2, g3},
PlotRange -> Automatic ,
PlotTheme -> "Automatic",
Frame -> True,
FrameLabel -> {"t = ln(μ/μ_0)", "Coupling Strength"}]]


The beta functions are defined as

$\qquad \frac{\partial g_1}{\partial t} = \frac{1}{16\pi}\frac{41}{6}g_1^3$

with $t = \log(\frac{\mu}{\mu_0})$.

So am I evaluating the ODE's over the variable $t$. But I want to express the x-axis in the energy $\mu$ instead.

How can I adjust the x-axis to reflect the energy?

I have tried to rewrite the RGE's in terms of $\mu$ instead of $t$ giving me

$\frac{\partial g_1}{\partial \mu} = \frac{1}{\mu} \frac{1}{16\pi}\frac{41}{6}g_1^3$

However, when I evaluate this, I get an $\frac{1}{0}$ error with, e.g., {mu, 1, 10000}.

With python for example I can easily adjust the values of the x-axis by $\mu = e^{t}\cdot\mu_0$ and which simply translates the values from to energy and reflects it also on the plot.

As an example, plotted with python what I have: What I want to get:

The values of mu indeed range from $[\approx 0, 1E22]$

Edit: Henrik's solution is what I was looking for:

LogLinearPlot[
Evaluate[{g1[Log[μ]], g2[Log[μ]], g3[Log[μ]]} /. sol], {μ, 1, 10^22},
PlotLegends -> {g1, g2, g3},
Frame -> True,
FrameLabel -> {"μ", "Coupling Strength"}
]


in my case $t = \ln(\frac{\mu}{\mu_0})$ instead of just $t = \ln(\mu)$, to achieve this one can just adjust

{g1[Log[μ]], g2[Log[μ]], g3[Log[μ]]}

to

{g1[Log[μ/μ_0]], g2[Log[μ/μ_0]], g3[Log[μ/μ_0]]}.

• Probably ypu are looking for LogLinearPlot. LogPlot and LogLogPlot may be also of interest. – Henrik Schumacher Jan 27 '18 at 23:35
• Thanks for your help, the plot should indeed be adjusted to one of those plots. However $t$ is evaluated in the range 0 to 50, while $mu$ should show the range 0 to $e^{50} \mu_0$, which is of the order ~1E22. – Reverie Jan 28 '18 at 0:03
• The relation between t and μ is not clear in your post. Please edit the question to give a Mathematica expression for this relation. – m_goldberg Jan 28 '18 at 1:36

A proposal without messing with the tickmarks: Just plot the functions you meant, namely $g_1 \circ \ln$, $g_2 \circ \ln$, and $g_3 \circ \ln$ (up to some constants) with a LogLinearPlot:

LogLinearPlot[
Evaluate[{g1[Log[μ]], g2[Log[μ]], g3[Log[μ]]} /. sol], {μ, 1, 10^22},
PlotLegends -> {g1, g2, g3},
Frame -> True,
FrameLabel -> {"μ", "Coupling Strength"}
]


• Dear Henrik, this is exactly what I was looking for! Thank you so much! I did not know it was possible to evaluate to Log as the only thing that came to mind was setting g1'[t] == 1/(16*Pi^2)*(41/6)*g1[t]^3 to g1'[Log[mu]] == 1/(16*Pi^2)*(41/6)*g1[Log[mu]]^3 Which when I evaluate it says I don't have a correct variable, but I did not consider your alternative. – Reverie Jan 28 '18 at 11:55
• Glad to be of help! – Henrik Schumacher Jan 28 '18 at 11:56

You could use ChartingScaledTicks and ChartingScaledFrameTicks:

Plot[
Evaluate[{g1[t],g2[t],g3[t]}/.sol],
{t,0,50},
PlotLegends->{g1,g2,g3},
Frame->True,
FrameLabel->{"\[Mu]","Coupling Strength"},
FrameTicks->{
{Automatic,Automatic},
{ChartingScaledTicks[{Log,Exp}],ChartingScaledFrameTicks[{Log,Exp}]}
}
]


xticks = {N @ Log[10^#], Superscript[10, #]}&/@Range[1, 22, 3];

Show[Plot[Evaluate[{g1[t], g2[t], g3[t]} /. sol], {t, 0, 50}],
Frame -> True, FrameTicks -> {{Automatic, Automatic}, {xticks, Automatic}}]