Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I've been trying to get loglog plots in 3D, but to no avail. My initial approach was to take the logarithm inside the plot i.e

Plot3D[Log[10,function[a, b]],{a, 1, 100000},{b, 1, 1000000}]

but now I'm looking for a way to logarithm-ise the axes as well. Any help would be greatly appreciated!

share|improve this question
2  
Something that you could do would be to get the logarithm outside the plot, and then use the LogTicks (from the LevelScheme package) to rescale the axes. This worked for me –  Sosi Mar 13 '13 at 14:53
3  
@Sosi why don't you post that (with details) as an answer? –  rcollyer Mar 13 '13 at 15:06
1  
@Sosi, thanks, but I'm very new to mathematica and unfamiliar with the LogTicks command. Could you give me any tips on using it? –  Gokotai Mar 13 '13 at 17:15

3 Answers 3

up vote 16 down vote accepted

You first have to install the LevelScheme package, it's worth it if you produce a lot of figures.

Load the package:

<< LevelScheme

Assign a function and do the 3D plot:

function = Log[10, a x + b /. a -> 1];
Plot3D[function, {x, 1, 3}, {b, -1, 3}, 
 PlotRange -> {{1, 3}, {-1, 3}, {-1, 1}}, 
 Ticks -> {LogTicks[10, 1, 3], LogTicks[10, -1, 3], LogTicks[10, -1, 1]}
]

This would produce this figure:

enter image description here

LevelScheme (and more specifically the Custom Ticks package) is really nice to do these things!

share|improve this answer
    
This helped alot, thanks a bunch! –  Gokotai Mar 13 '13 at 20:00
2  
Maybe still more for future versions of Mathematica but the option ScalingFunctions -> {"Log", "Reverse"} has been introduced for Gauges, Histograms and BarCharts in version 9. Unluckily, it fails in number of instances. I reported this as an error a while ago. Since the implementation is very general, I cannot see why it should not also become available for all other Plot-related functions. –  Ernst Stelzer Mar 14 '13 at 7:33
    
LevelScheme uses the same method that Martin Wijaya uses in his answer, but it adds features to make the plot look more professional. On page 4 of LevelScheme's CustomTickGuide.pdf, it states how to turn logarithmic plots into linear plots, which is how LevelScheme functions. –  Paul Mar 5 at 19:34
1  
I wonder why I even use the replacement function in my answer... –  Sosi Mar 6 at 11:51

LogTicks is really nice. However, if you might wish to avoid another package or have more control over the final output, here is a template. As mentioned in a comment above, I actually hope that ScalingFunctions will be fully implemented in the future.

function[a_, b_] := Log[10, a + b]

Plot3D[Log[10, function[#^10 &@a, #^10 &@b]], {a, Log10@1, 
  Log10@100000}, {b, Log10@1, Log10@100000}, 
 Ticks -> {Table[{y, ToString[Round[10^y, 0.001]]}, {y, Log[10, 1], 
     Log[10, 100000]}], 
   Table[{y, 
     ToString[
      Round[10^y, 0.001] // ScientificForm // TraditionalForm]}, {y, 
     Log[10, 0.001], Log[10, 100000]}], Automatic}]

enter image description here

share|improve this answer

Perhaps this is what you want:

Let say the function is describe as:

z=Log10[x]+Log10[y]

Where under normal plot, it will give you a curvy surface while on the log plot will give you a rectangular surface.

And you want to rescale the axes of x,y without changing the function of x and y.

Under normal circumstances, you will plot it like below to give you the curvy surface,

Plot3D[z, {x, 1, 1000}, {y, 1, 1000}]

Surface under normal plot

In order to change it into a rectangular surface due to the change in the x and y axes scale, you can do the following

Plot3D[z/.{x->10^a,y->10^b},{a,0,3},{b,0,3}]

Surface by changing the axes

In order to change the axes from a and b to x and y again and keep the log scale, Since I know that if a = 1 then x = 10, then i can just rename the axes with ticks function.you can do the following

Plot3D[z /. {x -> 10^a, y -> 10^b}, {a, 0, 3}, {b, 0, 3}, Ticks -> {Table[{i,10^i},{i,0, 6}], Table[{i, 10^i}, {i, 0, 6}], Automatic}]

Surface by changing the scale

I hope this is what are you looking for.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.