Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: sfeam Newsgroups: comp.graphics.apps.gnuplot Subject: Re: histogram : without using commanade "smooth freq" Followup-To: comp.graphics.apps.gnuplot Date: Thu, 15 Aug 2013 17:18:24 -0700 Organization: gnuplot development team Lines: 35 Message-ID: References: <0954fd20-3f7d-4898-bdd4-5e95b239bea5@googlegroups.com> <9a3488c0-c506-4c0c-a254-f2b0f7bc5eb4@googlegroups.com> Reply-To: sfeam@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit Injection-Date: Fri, 16 Aug 2013 00:18:26 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="8e86a57dfa599721f116da4577f3d1af"; logging-data="3682"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18NtL+BmqfZ0t+3g61+7pRH" User-Agent: KNode/4.4.9 Cancel-Lock: sha1:GQx52nr/wLgC7BV4uyFxP4L/4zE= Xref: csiph.com comp.graphics.apps.gnuplot:1976 D.GH wrote: > With the following code: > > set boxwidth 0.2 absolute > set table 'out1.dat' > plot 'mydata.dat' using ($1):(1) smooth freq w boxes > unset table > By this method we did not have control over the number of intervals for > the histogram to present. Huh? "smooth frequency" can be used to generate a histogram of binned values, but that is not what the command intrinsically does. If you do not provide an explicit binning function with defined intervals, then the data itself is the only source of x-coordinates. You get one output entry for each unique input x-coord. "help smooth freq" says: The `frequency` option makes the data monotonic in x; points with the same x-value are replaced by a single point having the summed y-values. To plot a histogram of the number of data values in equal size bins, set the y-value to 1.0 so that the sum is a count of occurances in that bin: Example: binwidth = # set width of x values in each bin bin(val) = binwidth * floor(val/binwidth) plot "datafile" using (bin(column(1))):(1.0) smooth frequency