]> git.lyx.org Git - features.git/commitdiff
Enable graphics generation from external gnuplot scripts.
authorTommaso Cucinotta <tommaso@lyx.org>
Mon, 17 Oct 2016 06:44:16 +0000 (08:44 +0200)
committerTommaso Cucinotta <tommaso@lyx.org>
Wed, 3 May 2017 22:44:00 +0000 (00:44 +0200)
lib/Makefile.am
lib/configure.py
lib/scripts/gnuplot2pdf.py [new file with mode: 0755]

index 66fe0516e9d3e5d0fe0e4bee84a41cca77633a1d..fc578a59d478f2d873055a6e62a082542240425f 100644 (file)
@@ -2332,6 +2332,7 @@ dist_scripts_DATA += \
        scripts/svg2pdftex.py \
        scripts/svg2pstex.py \
        scripts/fig_copy.py \
+       scripts/gnuplot2pdf.py \
        scripts/html2latexwrapper.py \
        scripts/include_bib.py \
        scripts/layout2layout.py \
index f995c62ca76f7f3b4674dd0fc080ee0a7a6ccad6..59f89f67db74d3bbf464c123e04b3e404fc41d8d 100644 (file)
@@ -1045,7 +1045,10 @@ def checkConverterEntries():
         rc_entry = [ r'''\converter svg        png        "%%"    "",
 \converter svgz       png        "%%"    ""'''],
         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
     checkProg('a spreadsheet -> latex converter', ['ssconvert'],
diff --git a/lib/scripts/gnuplot2pdf.py b/lib/scripts/gnuplot2pdf.py
new file mode 100755 (executable)
index 0000000..fb036b2
--- /dev/null
@@ -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()