logaritmic histogram

Just set the xscale attribute for the axes to be 'log' (and

    >> make sure you have strictly positive data, of course)
    >>
    >> ax = subplot(111, xscale='log') ax.hist(X, 100)
    >>

    > It works. Thanke you very mych. But if I want to set
    > logaritmic Y-axes also:

    > ax = subplot(111, xscale='log', yscale='log' )

    > I get:

My guess is that this is caused by having a histogram bin with no
values, and the log of 0 is undefined. It would be nice if we could
fix this code to be fault tolerant to invalid data, as we did for line
data.

You can inspect the hist output by doing

  n, bins = matplotlib.mlab.hist(X, 100)

and then seeing what the minimum n is. If it is 0, that is likely to
be the source of your troubles,

    > PS: 'X' contais whole nubers >= 1.

You might try setting the bins manually to workaround this problem, eg
define the bins such that there are no empty bins.

  mybins = nx.arange(1,20)
  n, bins = matplotlib.mlab.hist(X, bins)

Note that matplotlib.mlab.hist is the non-plotting version of hist
that actually computes the histogram.

JDH

···

On Tue, Dec 20, 2005 at 07:16:33PM -0600, John Hunter wrote: