Reputation: 185
I have created a histogram for some data that I have in a .dat file using the
binwidth=...
bin(x,width)=width*floor(x/width)
plot 'file' using (bin($1,binwidth) + binwidth/2):(1.0) smooth freq with boxes
but because my file has over 1,000,000 entries that it reads from and puts into different bins, I don't know the exact frequency/density of each bin is. I would like to know the frequency or have it write the frequency to a file possibly, does anyone know if its possible? I was also wondering whether instead of frequency it was possible to plot percentage on the y-axis so example if my frequency is 50,000 and my total number is 1,000,000 then on the y-axis to have a percentage instead of the actual frequency?
Thank you
Upvotes: 2
Views: 3176
Reputation: 48390
You can use the stats
command to get the number of entries.
stats 'file'
binwidth=...
bin(x,width)=width*floor(x/width)
plot 'file' using (bin($1,binwidth) + binwidth/2):(1.0/STATS_records) smooth freq with boxes
To plot the percentage use
plot 'file' using (bin($1,binwidth) + binwidth/2):(100.0/STATS_records) smooth freq with boxes
Upvotes: 7