|
From: Matthias M. <Mat...@gm...> - 2007-02-12 12:16:14
|
Hi Mika,=20
Hi everybody,
I'm not sure I really understand your problem, but I attached my proposal /=
=20
solution, so you can think about it or maybe describe your problem once mor=
e.
Much success,
Matthias Michler
>--------------------------------------------------------------------------=
=2D-----------------------
from pylab import figure, subplot, grid, close, show,\
hist, plot, semilogy, nonzero
x =3D 0.000925, 0.000879, 0.000926, 0.00088, 0.001016, 0.000931, 0.000927, \
0.00088, 0.000926, 0.000926, 0.000879, 0.0009
figure(0) # make histogram in figure 0
n, bins, patches =3D hist(x, 1000, align=3D'center')
close(0) # close figure to delete plot
# instance of hist
index =3D nonzero(n) # to solve problems mit zero
# values in log scale
figure(1)
ax =3D subplot(111)
ax.set_yscale('log')
l1 =3D plot(bins[index], n[index], ls=3D'',marker =3D'x', ms=3D15, mew=3D3,=
c=3D'r')
grid(True)
figure(2)
l2 =3D semilogy(bins[index], n[index], ls=3D'',marker =3D'x', ms=3D15, mew=
=3D3, c=3D'r')
grid(True)
show()
>--------------------------------------------------------------------------=
=2D------------------------
On Tuesday 06 February 2007 15:33, Mika Oraj=E4rvi wrote:
> Hi!
> I'm trying to generate some kind of "distribution" view / histogram
> of decimal numbers, i.e. i want the graph to indicate exactly how many
> times any given decimal number occurs in "x". As an example, i've set the
> values to tuple "x" as seen in the code snipplet below. In reality there
> will be at least couple of thousand decimal values or more in the tuple (x
> in this example) and values will be retrieved from file etc. This code do=
es
> seem to draw some kind of histogram but it would be much more usefull to
> have at least the y-scale as logarithmic. But I haven't found a way to ma=
ke
> the scale logarithmic. I've tried to use semilogy/semilogx/loglog but with
> no success.
>
> ---------------
> x=3D0.000925,0.000879,0.000926,0.00088,0.001016,0.000931,0.000927,0.00088,
> 0.000926,0.000926,0.000879,0.0009
> n, bins, patches =3D hist(x, 1000)
> l =3D plot(bins, n, 'r--')
> grid(True)
> show()
> ----------------
>
> regards, Mika
|