Enable graphics generation from external gnuplot scripts.

This commit is contained in:
Tommaso Cucinotta 2016-10-17 08:44:16 +02:00
parent cf6bbe2147
commit 066edd3c30
3 changed files with 22 additions and 1 deletions

View File

@ -2332,6 +2332,7 @@ dist_scripts_DATA += \
scripts/svg2pdftex.py \ scripts/svg2pdftex.py \
scripts/svg2pstex.py \ scripts/svg2pstex.py \
scripts/fig_copy.py \ scripts/fig_copy.py \
scripts/gnuplot2pdf.py \
scripts/html2latexwrapper.py \ scripts/html2latexwrapper.py \
scripts/include_bib.py \ scripts/include_bib.py \
scripts/layout2layout.py \ scripts/layout2layout.py \

View File

@ -1045,7 +1045,10 @@ def checkConverterEntries():
rc_entry = [ r'''\converter svg png "%%" "", rc_entry = [ r'''\converter svg png "%%" "",
\converter svgz png "%%" ""'''], \converter svgz png "%%" ""'''],
path = ['', inkscape_path]) path = ['', inkscape_path])
#
checkProg('Gnuplot', ['gnuplot'],
rc_entry = [ r'''\Format gnuplot "gp, gnuplot" "Gnuplot" "" "" "" "vector" "text/plain"
\converter gnuplot pdf6 "python -tt $$s/scripts/gnuplot2pdf.py $$i $$o" ""''' ])
# #
# gnumeric/xls/ods to tex # gnumeric/xls/ods to tex
checkProg('a spreadsheet -> latex converter', ['ssconvert'], checkProg('a spreadsheet -> latex converter', ['ssconvert'],

17
lib/scripts/gnuplot2pdf.py Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/python
from subprocess import Popen, PIPE
from sys import argv, stderr, exit
import os
import shutil
if (len(argv) != 3):
stderr.write("Usage: %s <src_file> <dst_file>\n" % argv[0])
exit(1)
with open(argv[1], 'rb') as fsrc:
subproc = Popen("gnuplot", shell=True, stdin=PIPE)
subproc.stdin.write("set terminal pdf\nset output '%s'\n" % argv[2])
shutil.copyfileobj(fsrc, subproc.stdin)
subproc.stdin.write("exit\n")
subproc.wait()