How to use Gnuplot to create histogram from binned data from CSV file?

344 views Asked by At

I have a CSV file which is generated by a process that outputs the data in pre-defined bins (say from -100 to +100 in steps of 10). So, each line looks somewhat like this:

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20

i.e. 20 comma separated values, the first representing the frequency in the range -100 to -90, while the last represents the frequency between 90 to 100.

The problem is, Gnuplot seems to require the raw data for it to be able to generate a histogram, whereas I have only the frequency distribution. How do I proceed in this case? I'm looking for the simplest possible histogram, that perhaps displays the data using vertical bars.

1

There are 1 answers

2
Karl On

You already have histogram data, so you mustn't use "set histogram". Generate the x-values from the linenumbers, and do a simple boxplot

plot dataf using (($0-10)*10):$1 with boxes