#!/bin/bash
# Output file.pdf
file=trig
gnuplot << TOEND
# Setup output
set term postscript eps enhanced \
dashlength 4 \
linewidth 5 \
"Helvectica" 24\
color
set output "$file.eps"
#unset key
set yrange [-1.1:1.1]
set xlabel 'x'
set ylabel 'y'
# Format plot
p sin(x) t 'sin(x)'\
, cos(x) t 'cos(x)'
TOEND
epstopdf $file.eps
rm $file.eps
Make the code executable by running
chmod +x plot-gnu
Run the code with
./plot-gnu
You should now have a high quality plot in a file called trig.pdf
A useful plot that shows all of the available (black and white) linetypes can be created with the following code. Follow the same steps as above. This code makes a file call linetypes.pdf.
#!/bin/bash
# Output file.pdf
file=linetypes
gnuplot << TOEND
# Setup output
set term postscript eps enhanced \
dashlength 4 \
linewidth 5 \
"Helvectica" 24\
#color
set output "$file.eps"
unset key
set yrange [0:10]
set xlabel 'x'
set ylabel 'Linetype'
# Format plot
p 1 lt 1\
, 2 lt 2\
, 3 lt 3\
, 4 lt 4\
, 5 lt 5\
, 6 lt 6\
, 7 lt 7\
, 8 lt 8\
, 9 lt 9
TOEND
epstopdf $file.eps
rm $file.eps
No comments:
Post a Comment