diff --git a/README.rst b/README.rst index 9d90164..dad1d20 100644 --- a/README.rst +++ b/README.rst @@ -45,6 +45,13 @@ Requires - `Notebook`_ (IPython/Jupyter Notebook) - `Metakernel`_ +EPS terminal support requires ImageMagick and Wand: + +.. code-block:: bash + + brew install imagemagick + pip install Wand + Documentation ============= diff --git a/gnuplot_kernel/epswrapper.py b/gnuplot_kernel/epswrapper.py new file mode 100644 index 0000000..042fb6c --- /dev/null +++ b/gnuplot_kernel/epswrapper.py @@ -0,0 +1,5 @@ +from wand.image import Image as WImage + +class EPS(WImage): + def __init__(self, filename): + super(EPS, self).__init__(filename=filename) \ No newline at end of file diff --git a/gnuplot_kernel/kernel.py b/gnuplot_kernel/kernel.py index 078912c..a1ef8cc 100644 --- a/gnuplot_kernel/kernel.py +++ b/gnuplot_kernel/kernel.py @@ -9,6 +9,7 @@ from .replwrap import GnuplotREPLWrapper, PROMPT from .exceptions import GnuplotError +from .epswrapper import EPS # This is the only place that the version is # specified @@ -232,6 +233,8 @@ def display_images(self): if self.inline_plotting: if settings['format'] == 'svg': _Image = SVG + elif settings['format'] == 'eps': + _Image = EPS else: _Image = Image diff --git a/gnuplot_kernel/magics/gnuplot_magic.py b/gnuplot_kernel/magics/gnuplot_magic.py index 7cf6af3..07f26c0 100644 --- a/gnuplot_kernel/magics/gnuplot_magic.py +++ b/gnuplot_kernel/magics/gnuplot_magic.py @@ -48,13 +48,14 @@ def line_gnuplot(self, *args): inline_terminals = {'pngcairo': 'png', 'png': 'png', 'jpeg': 'jpg', - 'svg': 'svg'} + 'svg': 'svg', + 'postscript': 'eps'} format = inline_terminals.get(terminal, 'png') if backend == 'inline': if terminal not in inline_terminals: msg = ("For inline plots, the terminal must be " - "one of pngcairo, jpeg, svg or png") + "one of pngcairo, jpeg, svg, png or postscript") raise ValueError(msg) self.kernel.plot_settings['backend'] = backend