Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #1962
| Newsgroups | comp.graphics.apps.gnuplot |
|---|---|
| Date | 2013-08-12 15:35 -0700 |
| References | <e0059ccb-ef28-4df1-9e19-a66392495f49@googlegroups.com> <ku9u8s$nh6$1@news.rz.uni-karlsruhe.de> |
| Message-ID | <0954fd20-3f7d-4898-bdd4-5e95b239bea5@googlegroups.com> (permalink) |
| Subject | Re: histogram : without using commanade "smooth freq" |
| From | "D.GH" <dariush.ghorbanzadeh@gmail.com> |
On Monday, August 12, 2013 8:10:38 AM UTC+2, Karl wrote:
> Am 12.08.2013 01:29, schrieb D.GH:
>
> > I would like to build the histogram (without using commanade "smooth freq" of GNUPLOT) of these data with a number of intervals (n_bins) that varies.
>
> >
>
>
>
> So you want to be able to change the bin size, so that more than one
>
> number lands in the same bin, right?
>
>
>
> Why don´t you construct a function that converts your values to bin
>
> numbers, something like
>
> bin(x) = int(x/bs)
>
>
>
> with bs being (xmax-xmin) / bin_number,
>
> and then
>
>
>
> plot fname using (bin($1)):xticlabels($1) smooth freq
> ? (Hope the thing with the labels works, haven´t tried now.)
> Karl
Here is my data : 'mydata.dat'
1120
1160
963
1546
258
964
1128
1169
1007
259
179
1408
1207
1389
308
1179
147
508
1148
1308
here my code :
reset
stats 'mydata.dat' u 1 name "XX"
bin_number=4
bs=(XX_max-XX_min) / bin_number
bin(x) =bs*int(x/bs)
set table 'out1.dat'
plot 'mydata.dat' using (bin($1)):(1.0) smooth freq with boxes
unset table
the output file: 'out1.dat'
# Curve 0 of 1, 6 points
# x y xlow xhigh type
0 5 0 0 i
349.75 1 349.75 349.75 i
699.5 3 699.5 699.5 i
1049.25 9 1049.25 1049.25 i
1399 2 1399 1399 i
349.75 1 349.75 349.75 u ***(I do not understand why there is this last line!)
#######
We note that the (left) end of the first interval should be the minimum 'mydata' = 147, whereas here ('out1.dat' = 0). the (right) end of the last interval should be maximum 'mydata' = 1546, whereas here ('out1.dat' = 1399).
This is why I asked if there was another way to construct the histogram of intervals.
Back to comp.graphics.apps.gnuplot | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
histogram : without using commanade "smooth freq" "D.GH" <dariush.ghorbanzadeh@gmail.com> - 2013-08-11 16:29 -0700
Re: histogram : without using commanade "smooth freq" Karl <mail.kfr@gmx.net> - 2013-08-12 08:10 +0200
Re: histogram : without using commanade "smooth freq" "D.GH" <dariush.ghorbanzadeh@gmail.com> - 2013-08-12 15:35 -0700
Re: histogram : without using commanade "smooth freq" Karl <ratzsch@polymer.uka.de> - 2013-08-13 09:37 +0200
Re: histogram : without using commanade "smooth freq" "D.GH" <dariush.ghorbanzadeh@gmail.com> - 2013-08-13 06:45 -0700
Re: histogram : without using commanade "smooth freq" "D.GH" <dariush.ghorbanzadeh@gmail.com> - 2013-08-13 10:48 -0700
Re: histogram : without using commanade "smooth freq" Karl <mail.kfr@gmx.net> - 2013-08-14 16:27 +0200
Re: histogram : without using commanade "smooth freq" sfeam <sfeam@users.sourceforge.net> - 2013-08-14 08:46 -0700
Re: histogram : without using commanade "smooth freq" Karl <mail.kfr@gmx.net> - 2013-08-14 18:48 +0200
Re: histogram : without using commanade "smooth freq" Karl <mail.kfr@gmx.net> - 2013-08-14 18:54 +0200
Re: histogram : without using commanade "smooth freq" sfeam <sfeam@users.sourceforge.net> - 2013-08-14 18:05 -0700
Re: histogram : without using commanade "smooth freq" "D.GH" <dariush.ghorbanzadeh@gmail.com> - 2013-08-15 16:00 -0700
Re: histogram : without using commanade "smooth freq" sfeam <sfeam@users.sourceforge.net> - 2013-08-15 17:18 -0700
Re: histogram : without using commanade "smooth freq" Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2013-08-13 22:35 +0200
csiph-web