Reputation: 435
I have data something like this:
# c1 c2 c3
23 b 323
23 g 54
23 a 11
23 c 1
23 d 0
23 e 397
23 f 40
24 b 23
24 g 24
24 a 113
24 c 12
24 d 10
24 e 7
24 f 50
I need to plot with c1 on x-axis (23,24), c3 on y-axis for different values of c2 i.e, multiple graphs with different colors for each value of c2.
Upvotes: 5
Views: 1756
Reputation: 48440
In general, you must do the filtering outside of gnuplot, in order to have lines connecting the filtered points.
If you know all values which can appear in the second column, you can use the solution given in Plotting multiple graphs depending on column value with gnuplot.
If you don't know the possible values, you can extract them with
c2s = system("awk '!/^#/ { print $2 }' test.dat | sort | uniq")
and then plot them with
plot for [c2 in c2s] sprintf('< grep ''\b%s\b'' test.dat', c2) using 1:3 with lines title c2
Upvotes: 3