* mu-guile: allow passing extra options to gnuplot in mu:plot-histogram

This commit is contained in:
D. LoBraico
2013-03-18 17:45:11 -05:00
parent 85f0064fea
commit 931a144387

View File

@ -46,7 +46,7 @@ not found."
progpath progpath
#f)))) #f))))
2 2
(define* (mu:plot-histogram data title x-label y-label #:optional (text-only #f)) (define* (mu:plot-histogram data title x-label y-label #:optional (text-only #f) (extra-gnuplot-opts '()))
"Plot DATA with TITLE, X-LABEL and X-LABEL. If TEXT-ONLY is true, "Plot DATA with TITLE, X-LABEL and X-LABEL. If TEXT-ONLY is true,
display using raw text, otherwise, use a graphical window. DATA is a display using raw text, otherwise, use a graphical window. DATA is a
list of cons-pairs (X . Y)." list of cons-pairs (X . Y)."
@ -57,11 +57,12 @@ list of cons-pairs (X . Y)."
(gnuplot (open-pipe "gnuplot -p" OPEN_WRITE))) (gnuplot (open-pipe "gnuplot -p" OPEN_WRITE)))
(display (string-append (display (string-append
"reset\n" "reset\n"
"set term " (if text-only "dumb" "wxt") "\n" "set term " (if text-only "dumb" "qt") "\n"
"set title \"" title "\"\n" "set title \"" title "\"\n"
"set xlabel \"" x-label "\"\n" "set xlabel \"" x-label "\"\n"
"set ylabel \"" y-label "\"\n" "set ylabel \"" y-label "\"\n"
"set boxwidth 0.9\n" "set boxwidth 0.9\n"
(string-join extra-gnuplot-opts "\n")
"plot \"" datafile "\" using 2:xticlabels(1) with boxes fs solid\n") "plot \"" datafile "\" using 2:xticlabels(1) with boxes fs solid\n")
gnuplot) gnuplot)
(close-pipe gnuplot))) (close-pipe gnuplot)))