Skip to content Skip to sidebar Skip to footer

Gnuplot: Plotting One Series Per Line Of Input Values

I have a CSV file that looks like this: fft_0,fft_1,fft_2,fft_3,fft_4,fft_5,fft_6,fft_7,fft_8,fft_9,fft_10,fft_11,fft_12,fft_13,fft_14,fft_15,fft_16,fft_17,fft_18,fft_19,fft_20,fft

Solution 1:

Right, I think I solved it (using the answer from https://stackoverflow.com/a/8716495/666259 and the answer from Christoph):

set terminal png size 1920,1080set datafile sep ","
unset keyset xtics 0,5,255set title "mytitle"set autoscale cbfix
plot "fft.csv" matrix using1:3:2with lines palette

This gives me something like this:

fft plot

Solution 2:

In order to have every line with a different color, use either palette or linecolor variable:

set datafile separator ','
set autoscale cbfix
plot 'file.csv' matrix every :::1 using 1:3:2 with lines palette

This uses the row number to color the lines based on the current palette. This is very useful if you have many lines to draw. set autoscale cbfix prevents the color range to be extended to the next major tics.

For only a few lines, you could also use

plot 'file.csv' matrix every :::1 using 1:3:2 linecolor variable with lines

This uses the row number as index for the linetype.

Post a Comment for "Gnuplot: Plotting One Series Per Line Of Input Values"