On Thu, Feb 18, 2010 at 10:25 AM, Jan Strube <curious...@gmail.com> wrote:
> Hi Eric,
> thanks for your response.
>
> Your solution looks like it's going to return the right numbers, but for
> some reason the tick labels are gone completely. (Except 0)
>
> The code I have is below. I do think the current behavior is a bug, but if I
> can get your workaround to go, I'll be happy.

What's the bug -- the fact that the tick labels are the log10 of the
number instead of the number?

I tried Eric's proposal with your code and it is working for me
(colorbar tick labels at 1, 10 and 100)

JDH


import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import LogFormatter

class LogFormatterHB(LogFormatter):
    def __call__(self, v, pos=None):
        vv = self._base ** v
        return LogFormatter.__call__(self, vv, pos)

data = np.load('deltaR_parton_jet_109371.npz')
ptcut = np.logical_and(data['jetMomentum'] < 300000, data['jetMomentum']>0)
deltaRCut = data['deltaR']>0
cut = np.logical_and(ptcut, deltaRCut)
fig = plt.figure()
plt.hexbin(data['jetMomentum'][cut] / 1000, data['deltaR'][cut],
gridsize=50, bins='log')
plt.title('deltaR between parton(eta<2.5) and jet(eta<2.5)')
plt.xlabel('jet pt (GeV)')
plt.ylabel('deltaR')
cb = plt.colorbar(format=LogFormatterHB())
cb.set_label('# entries')
plt.show()

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to