aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-02-21 18:45:17 -0800
committerbnewbold <bnewbold@robocracy.org>2016-02-21 18:45:17 -0800
commitba0bb2fc756deaa8f02cc58148fc4ef9095e85ff (patch)
treeeb23e331351ea5ede262c1ef353589bfdf185161
parentb24f282bca4af63982937c10835063d3e6e9eb74 (diff)
downloadPyX.jl-ba0bb2fc756deaa8f02cc58148fc4ef9095e85ff.tar.gz
PyX.jl-ba0bb2fc756deaa8f02cc58148fc4ef9095e85ff.zip
add conditional (py3) writeSVGfile function export
-rw-r--r--README.md2
-rw-r--r--src/PyX.jl11
2 files changed, 9 insertions, 4 deletions
diff --git a/README.md b/README.md
index 70af703..031f8cc 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ It is a work in progress, broken, and will set your computer on fire.
using PyX
g = graph.graphxy(width=8)
-plot(graph_data_function("y(x)=sin(x)/x", min=-15, max=15))
+plot(g, graph_data_function("y(x)=sin(x)/x", min=-15, max=15))
writeEPSfile(g, "function")
writePDFfile(g, "function")
writeSVGfile(g, "function")
diff --git a/src/PyX.jl b/src/PyX.jl
index b4097a9..9210f5e 100644
--- a/src/PyX.jl
+++ b/src/PyX.jl
@@ -12,8 +12,9 @@ export graph, graph_axis, graph_axis_painter, graph_data, graph_style, graph_sty
export graph_graphxyz, graph_data_function
export epsfile, deformer, trafo, attr, metapost_path
export plot, stroke
-export writeEPSfile, writePDFfile, writeSVGfile
+export writeEPSfile, writePDFfile
export pyx_fill, pyx_append, pyx_insert, pyx_text
+# See also Python3 section at end
canvas = pywrap(pyimport("pyx.canvas"))
path = pywrap(pyimport("pyx.path"))
@@ -88,8 +89,12 @@ function writePDFfile(g::PyObject, args...; kwargs...)
return g[:writePDFfile](args...; kwargs...)
end
-function writeSVGfile(g::PyObject, args...; kwargs...)
- return g[:writeSVGfile](args...; kwargs...)
+# Some newer features only in recent (Python3) versions of PyX
+if PyCall.pyversion > v"3"
+ export writeSVGfile
+ function writeSVGfile(g::PyObject, args...; kwargs...)
+ return g[:writeSVGfile](args...; kwargs...)
+ end
end
end # module PyX