7
$\begingroup$

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.

$\endgroup$
3
  • 5
    $\begingroup$ What code have you tried so far? $\endgroup$ Commented Oct 21, 2013 at 3:51
  • 4
    $\begingroup$ Why not just do Log@ on your function? $\endgroup$
    – rm -rf
    Commented Oct 21, 2013 at 3:56
  • $\begingroup$ LogPlot will give you a logarithmic $y$-axis. $\endgroup$ Commented Oct 21, 2013 at 13:19

2 Answers 2

2
$\begingroup$

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:

enter image description here

It looks like a sheet folded along a line. I wonder what the equation of that line is?

$\endgroup$
1
  • 1
    $\begingroup$ David, would you also include the code to produce the plot? Might be useful. $\endgroup$
    – Yves Klett
    Commented Oct 21, 2013 at 16:26
1
$\begingroup$

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}]

enter image description here

$\endgroup$

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.