I want to plot column 3 and 4 with bars for each data set in the file, data set are identified by multiple newline and are referred using index as show in script below. I can draw this data with “linespoint”. My graph looks like my graph. But I want to plot data with “boxes” as I want graph like this.
x-axis will have column 3 (1,2,3) and y-axis will have column 4, For each value of x (1,2,3) there should be 2 bars, one from index 0 and second from index 1.
Data file looks like:
2-100
2 100 1 3.10 249
2 100 2 3.41 250
2 100 4 3.70 249
3-100
3 100 1 3.10 252
3 100 2 3.48 252
3 100 4 3.72 254
2-100 an 3-100 will be used as title “first row of block and first column”, first 4 lines are read as “index o” in script and second 4 lines as “index 1”
script I used:
plot \
"$1" index 0 using 3:4 with boxes fs solid title columnhead(1),\
"$1" index 1 using 3:4 with boxes fs solid title columnhead(1)
I’ve reformatted your datafile a little bit (at least, if I understood your original question correctly) — It now looks like:
You should be able to format your datafile like this using
sed:(this assumes that the column heads always start with a number (0-9) and then “-100”. You’re re might need to be a little more interesting if your datafile is a little more complicated.
This can be plotted using:
Of course, you can break up the for loop to assign special properties to each plot or whatever…
If you want special labels, you can do this
before your plot command.
Here’s what I get using the above with the png (libgd) terminal: