gnuplot -e 'set terminal pngcairo; set output "out.png"; set datafile separator ","; plot "data.csv" using 2:4 with lines'

Category: Data Science & Analysis

gnuplot -e 'set terminal pngcairo; set output "out.png"; set datafile separator ","; plot "data.csv" using 2:4 with lines'

Plot columns 2 and 4 of a CSV as a line chart

gnuplot is a mature plotting program driven by commands. The -e flag executes a command string before plotting, here setting the pngcairo terminal, naming the output file out.png, and declaring the comma delimiter with set datafile separator. The plot command draws column 4 against column 2 using the 2:4 column specifier, with lines connecting the points. The result is a PNG image ready to view or embed.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.