feedgnuplot: Bar charts
Assuming data that looks like labeled curves:
x1 c1 y1 c2 y1
x2 c1 y2 c2 y2
The default feedgnuplot will be points:
seq 10 \
| awk '{print $1, "Doubled", $1*2, "Incremented", $1+2}' \
| feedgnuplot \
--domain \
--dataid \
--autolegend \
--terminal "dumb ansi 120,40"
We can specify --points --lines
to join the points:
To get barcharts, we can override the curve selection expressions and insist on the histogram style:
seq 10 \
| awk '{print $1, "Doubled", $1*2, "Incremented", $1+2}' \
| feedgnuplot \
--domain \
--dataid \
--usingall "2:xticlabels(1)" \
--set "style data histogram" \
--autolegend \
--terminal "dumb ansi 120,40"
For clearer output try the following:
--set "key out"
- legend outside plot--set "key out center bottom"
- legend outside, below plot--set "key textcolor variable"
- legend text in same color as bars--set "key out center bottom textcolor variable"
- altogether
Pretty example:
seq 10 \
| awk '{print $1, "Doubled", $1*2, "Incremented", $1+2}' \
| feedgnuplot \
--domain \
--dataid \
--usingall "2:xticlabels(1)" \
--set "style data histogram" \
--autolegend \
--terminal "dumb ansi 120,40" \
--unset "grid" \
--set "tic out" \
--set "xtic nomirror" \
--set "boxwidth 0.8 relative" \
--set "style histogram gap 2" \
--set "style fill solid border -1" \
--set "key out textcolor variable" \
--title "Some title" \
--ymin -1 --ymax 21
Published on: 14 Feb 2022