martes, 13 de marzo de 2012

Tarea 4: gnuplot


A continuación se proporcionan ejemplos de script para graficar a partir de un archivo de datos .txt

Gráfica 1: histograma

set term postscript eps enhanced 24 'Times-Roman'
set output "histo.eps"
set encoding iso_8859_1 #acentos
set term postscript color
unset key
set tmargin 5
set yrange [0:2000]
set border
set ylabel "Average times (sec)" font "Times-Roman, 26" 
set style histogram cluster gap 1
set style fill solid border -1
set xtics rotate by -20 ("Barrier" 0.0000, "Sifting" 1.0000, "Dual Simplex" 2.00, "Network Simplex" 3.00, "Primal Simplex" 4.00) font "Times-Roman,26" 
set grid ytics lt 3 lc rgb "gray10"
set boxwidth 1
plot "histo2.txt" using 2 lt rgb "gray40" with histograms

Gráfica 2: Gráfica de líneas

set term postscript color
set key spacing 1
set xtics  1,1,20     
set xrange [0:21]     
set yrange [0:200]
set key right center box  
set border
set grid lt 2 lc rgb "gray10"
#set grid lt 3 lc rgb "gray"
set xlabel "{/=26 Instances}" 
set ylabel "Values" font "Times-Roman, 26" 
set style line 1 linetype 3 lw 3 lc rgb "black" pointtype 7 
set style line 2 linetype 1 lw 2 lc rgb "black" pointtype 7
set style line 3 lc rgb 'black' lt 4 lw 4 pt 7 ps 1.5 
set style line 4 lc rgb 'black' lt 1 lw 4 pt 4        
set style line 5 lc rgb 'black' lt 2 lw 4 pt 6 #lt 3
set style line 6 lc rgb '#dd181f' lt 1 lw 3 pt 4 ps 1.5   # red
set style line 7 lc rgb 'blue' lt 3 lw 3 pt 7 ps 1.5   # --- blue
set style line 8 lc rgb '#dd181f' lt 1 lw 3 pt 6 ps 1.5   # --- red
set pointsize 1.5
set size 1.6, 3.1
set multiplot
set bmargin 5.0
set origin 0,1.5
set size 1.6, 1.4
set title  "{/Italic n}=60, {/Italic p}=4" font "Times-Roman,26"
plot "opt60.txt" using 1:2 w linespoints ls 3 title "DBS-P bound",\
     "opt60.txt" using 1:3 w linespoints ls 4 title "LR bound",\
     "opt60.txt" using 1:4 w linespoints ls 5 title "Optimal solution"
set origin 0,0
set size 1.6, 1.4
set yrange [0:180]
set title  "{/Italic n}=100, {/Italic p}=6" font "Times-Roman,26"
plot "opt100.txt" using 1:2 w linespoints ls 3 title "DBS-P bound",\
     "opt100.txt" using 1:3 w linespoints ls 4 title "LR bound",\
     "opt100.txt" using 1:4 w linespoints ls 5 title "Optimal Solution"

No hay comentarios:

Publicar un comentario