Tell me more ×
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 at 14:53
2  
@Sosi why don't you post that (with details) as an answer? – rcollyer Mar 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 at 17:15

2 Answers

up vote 10 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 at 20:00
1  
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 at 7:33

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

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.