Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a question on using logarithmic ticks in a colorbar in Mathematica 8.0 . I use the package ColorbarPlot (type->"Density") in order to show a legend. As well as the default ticks, I can set the ticks by myself.

The problem is that my data range is from $-10^{16}$ to $10^{16}$, and I cannot see the intermediate values because the values with large exponents at the two ends to the range absorb all the colour. One solution would be to have logarithmic ticks, but I have also negative values.

Do you have any ideas? If you have another solution without using Colorbarplot, it would also be welcome.

share|improve this question
Can you please link to this package? It is not a standard one. Where did you get it? Is it the one from – Szabolcs Nov 30 '12 at 15:25
That's the same package that Szabolcs was talking about – R. M. Nov 30 '12 at 15:49
Before version 9 came out I would have been tempted to dig out the package and look to see if I could add something. Post v9 I'm not sure if it's worth it. Thoughts? – WalkingRandomly Nov 30 '12 at 16:06
Also, the version at is more up to date than the one at the Wolfram library – WalkingRandomly Nov 30 '12 at 16:07

It's hard to help you without knowing what your exact function is and what plotting function you are using. But since you mentioned you were willing to consider an approach that didn't use the WalkingRandomly colorbar package, here is one option using the inbuilt legending functions in version 9+.

It sounds like you are using a ContourPlot. The trick is to set your contours explicitly so the smaller values get the most attention/contours. The legend will update accordingly. You can also use the explicit ColorFunction option to get more color variation in that part of the value range. I've used a cube root here but you could pick whatever you liked as long as it handled negative inputs.

ContourPlot[Exp[x y] Sin[x] Sin[y], {x, -4, 4}, {y, -4, 4}, 
 PlotRange -> All, PlotLegends -> Automatic, 
 ColorFunctionScaling -> False, 
 ColorFunction -> (ColorData["TemperatureMap"][
     Re[Power[#, (3)^-1]]] &), 
 Contours -> Join[{-10, -1}, 10^Range[-2, 7]]]

enter image description here

share|improve this answer

Your Answer


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.