|
From: Thomas S. <t.s...@fz...> - 2009-07-22 09:29:36
|
have a look at the gnuplot 4.3-cvs demo: http://gnuplot.sourceforge.net/demo_4.3/smooth.html jamborta wrote: > > hi guys, > > I have a continuous random variable with around 1200 values. I'd like to > plot the distribution of that dataset. I guess I could set up some > intervals and count how many values fall into that interval. is that > doable with gnuplot? > > thanks, > tamas > > -- View this message in context: http://www.nabble.com/plot-distribution-tp24593401p24602883.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Thomas S. <t.s...@fz...> - 2009-07-22 14:36:30
|
first we need a function for binning the x-data, i.e. the continuous x-range is split into intervals of size 's': bin(x, s) = s*int(x/s) then we plot: plot "datafile" using (bin($2,0.01)):(10/300.) \ smooth frequency \ title 'smooth frequency' with boxes explanation: - the bin-function assigns the x-values within one interval (which has a width of 0.01 here) to only one x-value (the lower interval border) - with 'smooth frequency' all the y-values of data pairs with the same x-value are added - "10/300." is just a factor, you could use "1." then each data counts as '1' jamborta wrote: > > thanks a lot. could you explain the parameters of this method > > plot [0:] "datafile" u 2:(0.25*rand(0)-.35) t '', "" u > (bin($2,0.01)):(10/300.) s f t 'smooth frequency' w boxes, "" u 2:(1/300.) > s cumul t 'smooth cumulative' > > especially 10/300. and 1/300. > > I couldn't figure out why it normalises in the demo, but not for my data. > > thanks a lot > > > Thomas Sefzick wrote: >> >> have a look at the gnuplot 4.3-cvs demo: >> >> http://gnuplot.sourceforge.net/demo_4.3/smooth.html >> >> >> jamborta wrote: >>> >>> hi guys, >>> >>> I have a continuous random variable with around 1200 values. I'd like to >>> plot the distribution of that dataset. I guess I could set up some >>> intervals and count how many values fall into that interval. is that >>> doable with gnuplot? >>> >>> thanks, >>> tamas >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/plot-distribution-tp24593401p24607667.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Thomas S. <t.s...@fz...> - 2009-07-23 07:30:24
|
the normalization factor needs to be know before you plot. what you could do: - make a dummy plot (see 'set table') to count the data entries, have a look at: http://gnuplot.sourceforge.net/demo_4.3/data_feedback.html (look for 'sum') - calculate the normalization factor - do the plot e.g.: set table sum=0 plot 'datafile' using 1:(sum=sum+$1) unset plot print sum plot 'datafile' using 1:(1./sum) smooth frequency with boxes jamborta wrote: > > that's great. it's clear now. maybe it'd be useful to have a function that > counts how many entries the set has, so it'd be easy to normalise it. > > > Thomas Sefzick wrote: >> >> first we need a function for binning the x-data, i.e. the >> continuous x-range is split into intervals of size 's': >> bin(x, s) = s*int(x/s) >> >> then we plot: >> plot "datafile" using (bin($2,0.01)):(10/300.) \ >> smooth frequency \ >> title 'smooth frequency' with boxes >> >> explanation: >> - the bin-function assigns the x-values within one interval >> (which has a width of 0.01 here) to only one x-value (the >> lower interval border) >> - with 'smooth frequency' all the y-values of data pairs >> with the same x-value are added >> - "10/300." is just a factor, you could use "1." then each >> data counts as '1' >> >> >> jamborta wrote: >>> >>> thanks a lot. could you explain the parameters of this method >>> >>> plot [0:] "datafile" u 2:(0.25*rand(0)-.35) t '', "" u >>> (bin($2,0.01)):(10/300.) s f t 'smooth frequency' w boxes, "" u >>> 2:(1/300.) s cumul t 'smooth cumulative' >>> >>> especially 10/300. and 1/300. >>> >>> I couldn't figure out why it normalises in the demo, but not for my >>> data. >>> >>> thanks a lot >>> >>> >>> Thomas Sefzick wrote: >>>> >>>> have a look at the gnuplot 4.3-cvs demo: >>>> >>>> http://gnuplot.sourceforge.net/demo_4.3/smooth.html >>>> >>>> >>>> jamborta wrote: >>>>> >>>>> hi guys, >>>>> >>>>> I have a continuous random variable with around 1200 values. I'd like >>>>> to plot the distribution of that dataset. I guess I could set up some >>>>> intervals and count how many values fall into that interval. is that >>>>> doable with gnuplot? >>>>> >>>>> thanks, >>>>> tamas >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/plot-distribution-tp24593401p24620723.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |