Gnuplot

From Wiki
Jump to navigation Jump to search

Create a title:                  > set title "Force-Deflection Data"
Put a label on the x-axis:       > set xlabel "Deflection (meters)"
Put a label on the y-axis:       > set ylabel "Force (kN)"
Change the x-axis range:         > set xrange [0.001:0.005]
Change the y-axis range:         > set yrange [20:500]
Have Gnuplot determine ranges:   > set autoscale
Move the key:                    > set key 0.01,100
Delete the key:                  > unset key
Put a label on the plot:         > set label "yield point" at 0.003, 260
Remove all labels:               > set nolabel
Plot using log-axes:             > set logscale
Plot using log-axes on y-axis:   > set nologscale; set logscale y
Change the tic-marks:            > set xtics (0.002,0.004,0.006,0.008)
Return to the default tics:      > set noxtics; set xtics

sample.plt:

plot 'sample.dat' using 2 title "close" with lines, \
'sample.dat' using 3 title "target-min", \
'sample.dat' using 4 title "target-max", \
'sample.dat' using 5 title "ema(20)" with lines


Run it using this command:

> load 'sample.plt'