Log colorbar

I have image data 2d array with values that spans several

    > decades. It would be extremely useful for me to be able
    > to plot this data with imshow using a colorbar/color
    > scale that is logarithmic. In the past I have just taken
    > the log of the data, but that solution is not really
    > acceptable for me. Any suggestions would be
    > welcome. Perhaps someone could give me a idea on how to
    > modify matplotlib to have this functionality. Thanks.

Jean-Luc also posted recently asking for logarithmic color scaling.
I would have thought that taking the log of your image data *would*
work for you. Can you explain why this doesn't -- I haven't worked
with logarithmic image data before so assume you are talking to a
newbie.

Note you can provide your own custom normalization and colormap
instances to imshow. These are generic functionals, so you should e
able to do anything you want. There is an example of writing a custom
normalization and colormap instance here

  [Playerstage-users] GetPose2d angle problem | The Player Project

If you write one that does what you need, please post it back here so
it can be folded into the mainline. If you have trouble with this, if
you just describe more thoroughly what you need one of us might be
able to do it.

JDH

Someday I will also need to create images with logscale colorbars. Right now,
I think it is a matter of taking the log of the data, and then manually
changing the ticklabels on the colorbar (-1,0,1 -> 10^{-1}, 10^0, 10^1). It
would be nice if we could do this automatically.

···

On Thursday 21 July 2005 10:22 am, John Hunter wrote:

    > I have image data 2d array with values that spans several
    > decades. It would be extremely useful for me to be able
    > to plot this data with imshow using a colorbar/color
    > scale that is logarithmic. In the past I have just taken
    > the log of the data, but that solution is not really
    > acceptable for me. Any suggestions would be
    > welcome. Perhaps someone could give me a idea on how to
    > modify matplotlib to have this functionality. Thanks.

Jean-Luc also posted recently asking for logarithmic color scaling.
I would have thought that taking the log of your image data *would*
work for you. Can you explain why this doesn't -- I haven't worked
with logarithmic image data before so assume you are talking to a
newbie.

--

Darren

Thanks for the reply. I work with lidar data, which like radar data
can span many decades. There is often negative values in the data so
taking the log of the data can be annoying (depending on the
programming environment). Also, the log of the data is less meaningful
(to me) so that means I'll end up changing the labels on the
colorabar. I guess you say it is also the principle of the matter.
I'll give your suggestion a try as soon as I have some time. Thanks!

Ralph

p.s. I'm just learning python and I just recently discovered
matplotlib (I've been using matlab for a long time) and I think it is
very well done. Great job.

···

On 7/21/05, John Hunter <jdhunter@...4...> wrote:

>>>>> <rekuehn@...287...> writes:

     I have image data 2d array with values that spans several
     decades. It would be extremely useful for me to be able
     to plot this data with imshow using a colorbar/color
     scale that is logarithmic. In the past I have just taken
     the log of the data, but that solution is not really
     acceptable for me. Any suggestions would be
     welcome. Perhaps someone could give me a idea on how to
     modify matplotlib to have this functionality. Thanks.

Jean-Luc also posted recently asking for logarithmic color scaling.
I would have thought that taking the log of your image data *would*
work for you. Can you explain why this doesn't -- I haven't worked
with logarithmic image data before so assume you are talking to a
newbie.

Note you can provide your own custom normalization and colormap
instances to imshow. These are generic functionals, so you should e
able to do anything you want. There is an example of writing a custom
normalization and colormap instance here

  [Playerstage-users] GetPose2d angle problem | The Player Project

If you write one that does what you need, please post it back here so
it can be folded into the mainline. If you have trouble with this, if
you just describe more thoroughly what you need one of us might be
able to do it.

JDH