plot "-" using 1:2:3 w yerrorbars
# X Y Z
1.0 1.2 0.2
2.0 1.8 0.3
3.0 1.6 0.2
4.0 1.2 0.2
end
gnuplot> plot "< head -10 test.dat" using 1:2 with lines
If no set output …, plot will be guided to stdin.
set xdata time
set timefmt "%Y-%m-%d %H:%M"
set format x "%Y\n%m/%d"
plot data.txt using 1:3 notitle with line
assuming the 1st column in data.txt is yyyy-mm-dd, the 2nd column is HH:MM, the 3rd column is the data.
set terminal png
set output picture.png # open picture.png
plot data.txt using 1:2 notitle with line
set output # close picture.png
plot "data.txt" using 1:2 title "set 1" using line,\
"data.txt" using 1:3 title "set 2" using line
gnuplot> test
set size 1.2, 0.6
the number must be a ratio. In the example above, 1.2 means 1.2 times the default width of x. 0.6 means 0.6 times the default width of y.
set key right bottom box
set grid
plot 'data.txt' using 2:($4/$3) title "1 PE" with linespoints
According to stackoverflow, the following can be used to plot the first two columns only when the third one equals zero:
plot 'example.dat' using 1:($3==0?$2:1/0)
1/0
is an invalid value, this will cause problems if one chooses to plot lines or linespoints.
Another hack would be to use a shell command like awk:
plot "< awk '$3==0 { print $1, $2 }' example.dat" using 1:2
Activities mentions in this site have been supported by the following grants: