# Plot3D with a log scale only along the y-axis

I would like to ask how to make a 3D plot (maybe using Plot3D) with a logarithmic scale along the y-axis?

For example: I have a function, $f(x) = 2(1 + a\,x^4)/x^2$, where $x$ varies from 0 to 20 while $a$ varies from 0 to $10^{-3}$. I am interested in making a 3D plot of $f(x)$ in a low range of $a$ such as from 0 to $10^{-7}$ or 0 to $10^{-5}$. Therefore, I think it might be better to scale the y-axis logarithmically.

Any suggestion would be highly appreciated.

• What code have you tried so far? – Mike Honeychurch Oct 21 '13 at 3:51
• Why not just do Log@ on your function? – rm -rf Oct 21 '13 at 3:56
• LogPlot will give you a logarithmic $y$-axis. – Stephen Luttrell Oct 21 '13 at 13:19

I don't see why this question should get negative ratings! It is a perfectly reasonable question and it takes a bit of exploration to obtain a graphical representation that illustrates the various features. We do have a problem of seeing the behavior at both small x and small a and it doesn't hurt to plot the log of the function. So define a new plotting function:

logf[logx_, loga_] := Log10[2 (1 + 10^loga 10^logx^4)/10^logx^2]


Then plotting with an ordinary scale we obtain: It looks like a sheet folded along a line. I wonder what the equation of that line is?

• David, would you also include the code to produce the plot? Might be useful. – Yves Klett Oct 21 '13 at 16:26

The question here is how to make a Plot3D with a logarithmic scale along only one of the axes, the y-axis. The variable in this case runs from $10^{-7}$ to $10^{-3}$. So the plan then is to take the $\log$ of the variable manually, and plot the function f[10^a, x] where a is the base-$10$ $\log$ of y. This gives us a $\log$ scale, and we could easily just label the axis as Log10[y] as David does above.

But it easy to generate nice log-scale tick marks using the CustomTicks package. To get it, grab the latest release of Scidraw:

f[a_, x_] := 2 (1 + a x^4)/x^2 ;
Needs@"CustomTicks"
Plot3D[f[10^a, x], {x, 0, 5}, {a, -7, -3},
Ticks -> {Automatic, LogTicks[10, -7, -3], Automatic}]
` 