Site
Gnuplot
Template
Histogram:
set term postscript eps enhanced monochrome
set output "auto-only-hint-normal.eps"
set style data histogram
set style histogram cluster gap 1
set style fill solid border -1
set boxwidth 0.9
set style fill pattern
set palette gray
#set key horizontal height 5 spacing 1.7
#set key noinvert reverse Left outside box spacing 2
#set key invert box
set key Left under reverse nobox spacing 3
set tics font "Helvetica,22"
set ylabel "Throughput (Mbps)" font "Helvetica,22"
set yrange [0:7]
plot 'filename' \
using 2:xtic(1) t '{/Helvetica=20 standard wo/ hint}', \
'' using 3 t '{/Helvetica=20 standard w/ hint}', \
'' using 4 t '{/Helvetica=20 smart header wo/ hint}', \
'' using 5 t '{/Helvetica=20 smart header w/ hint}', \
'' using 6 t '{/Helvetica=20 smart data wo/ hint}', \
'' using 7 t '{/Helvetica=20 smart data w/ hint}', \
'' using 8 t '{/Helvetica=20 smart header/data wo/ hint}', \
'' using 9 t '{/Helvetica=20 smart header/data w/ hint}'
line:
reset
set terminal postscript enhanced
set size ratio 0.7
file_name = "/Users/yichao/Project/L-MAC/Experiment/L-BEB/exp4_aifs/2010.08.02.cw0.1sta.s2.aifs4.6mbps.02.txt.cdf"
set output file_name.".eps"
set title "PDF"
set xlabel "interval (ms)"
set ytics nomirror
set ylabel "probability (%)"
# set key right bottom
# set key Left under reverse nobox spacing 1
set nokey
set style line 1 lc rgb "#FF0000" lt 1 lw 3
set style line 2 lc rgb "#0000FF" lt 1 lw 3
set style line 3 lc rgb "orange" lt 1 lw 3
set style line 4 lc rgb "green" lt 1 lw 3
set style line 5 lc rgb "yellow" lt 1 lw 3
set style line 6 lc rgb "black" lt 1 lw 3
plot file_name.".csv" using 1:2 with lines ls 1 title "1st level", \
"" using 1:3 with lines ls 2 title "2nd level"
line and dot
reset
set terminal postscript eps enhanced color 28
set size ratio 0.7
set xlabel "Single antenna tx time (ms)"
set ylabel "% decrease required \nin tx time"
set ytics nomirror
# set yrange [0:25]
set key right top
# set key Left under reverse nobox spacing 1
# set nokey
data_dir = "./"
fig_dir = "../motivation_figures/"
set output fig_dir."ett_motivation_plot.eps"
set style line 1 lc rgb "#FF0000" lt 1 lw 3
set style line 2 lc rgb "#0000FF" lt 4 lw 3
set style line 3 lc rgb "orange" lt 1 lw 3
set style line 4 lc rgb "green" lt 1 lw 3
set style line 5 lc rgb "yellow" lt 1 lw 3
set style line 6 lc rgb "black" lt 1 lw 3
#plot data_dir."ett_motivation.txt" using 1:3 with lines ls 2 title "3x3 Ant", \
# data_dir."ett_motivation.txt" using 1:2 with lines ls 1 title "2x2 Ant"
plot data_dir."ett_motivation.txt" using 1:3 with linespoints lt 5 lc rgb "red" lw 3 pt 4 title "3x3 Ant", \
data_dir."ett_motivation.txt" using 1:2 with linespoints lt 1 lc rgb "blue" lw 3 pt 2 title "2x2 Ant"
Useful commands
set logscale x
set key right bottom
set key Left under reverse nobox spacing 1
set nokey
plot "a.csv" using 1:2 with lines ls 1 title "a" axis x1y1
"" using 1:2 with lines ls 1 title "b" axis x1y2
Perl Module
use Chart::Graph::Gnuplot qw(&gnuplot);
my @data_sets;
foreach my $tr_i (0 .. scalar(@tr) - 1) {
my @data_set;
my $tmp = $tr[$tr_i];
my @diff = @$tmp;
push(@data_set, {'title' => 'trace $tr_i',
'type' => 'columns'});
push(@data_set, \@x);
push(@data_set, \@diff);
push(@data_sets, \@data_set);
}
gnuplot({'output type' => 'png',
'output file' => 'gnuplot1.png',
'extra_opts' => 'set key right top'},
@data_sets);