diff options
author | Julien Cornebise <julien.cornebise@gmail.com> | 2013-10-12 20:47:19 +0400 |
---|---|---|
committer | Julien Cornebise <julien.cornebise@gmail.com> | 2013-10-12 20:55:27 +0400 |
commit | 6f927766f39b2a73aa4653bd5f12ccbd7ab534b4 (patch) | |
tree | e06fd8727f5ba6efb029c3cb0ec09506046f1b8a /gnuplot.lua | |
parent | 9df164e0eb6677278a9f7cbbc92705e7d3384793 (diff) |
Add support for PDF in figprint if gnuplot supports
Gnuplot support for pdf is enabled in homebrew with
`brew install gnu plot --pdf``
Diffstat (limited to 'gnuplot.lua')
-rw-r--r-- | gnuplot.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gnuplot.lua b/gnuplot.lua index e59ca0d..34371cc 100644 --- a/gnuplot.lua +++ b/gnuplot.lua @@ -672,12 +672,24 @@ end function gnuplot.figprint(fname) local suffix = fname:match('.+%.(.+)') local term = nil + local haspdf = gnuplothasterm('pdf') or gnuplothasterm('pdfcairo') if suffix == 'eps' then term = 'postscript eps enhanced color' elseif suffix == 'png' then term = 'png size "1024,768"' + elseif suffix == 'pdf' and haspdf then + if gnuplothasterm('pdfcairo') then + term = 'pdfcairo' + else + term = 'pdf' + end + term = term .. ' enhanced color' else - error('only eps and png for figprint') + local errmsg = 'only eps and png' + if haspdf then + errmsg = errmsg .. ' and pdf' + end + error(errmsg ' for figprint') end writeToCurrent('set term ' .. term) writeToCurrent('set output \''.. fname .. '\'') |