summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md6
-rw-r--r--pandoc-plot.cabal2
-rw-r--r--src/Text/Pandoc/Filter/Plot/Renderers/Graphviz.hs7
3 files changed, 11 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fb3441c..6fd0ac6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,9 +2,13 @@
pandoc-plot uses [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
+## Release 1.5.4
+
+* Fixed an issue where graphviz plots in vector format were cropped when a DPI was specified (#40).
+
## Release 1.5.3
-* Fixed an issue where the `tight_bbox` option for Matplotlib plots was ignored (#48)
+* Fixed an issue where the `tight_bbox` option for Matplotlib plots was ignored (#48).
## Release 1.5.2
diff --git a/pandoc-plot.cabal b/pandoc-plot.cabal
index 319ad79..4580ff2 100644
--- a/pandoc-plot.cabal
+++ b/pandoc-plot.cabal
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: pandoc-plot
-version: 1.5.3
+version: 1.5.4
synopsis: A Pandoc filter to include figures generated from code blocks using your plotting toolkit of choice.
description: A Pandoc filter to include figures generated from code blocks.
Keep the document and code in the same location. Output is
diff --git a/src/Text/Pandoc/Filter/Plot/Renderers/Graphviz.hs b/src/Text/Pandoc/Filter/Plot/Renderers/Graphviz.hs
index fc69e98..6ca8f18 100644
--- a/src/Text/Pandoc/Filter/Plot/Renderers/Graphviz.hs
+++ b/src/Text/Pandoc/Filter/Plot/Renderers/Graphviz.hs
@@ -43,8 +43,11 @@ graphvizSupportedSaveFormats = [PNG, PDF, SVG, JPG, EPS, WEBP, GIF]
graphvizCommand :: Text -> OutputSpec -> Text
graphvizCommand cmdargs OutputSpec {..} =
let fmt = fmap toLower . show . saveFormat $ oFigureSpec
- dpi' = dpi oFigureSpec
- in [st|#{pathToExe oExecutable} #{cmdargs} -T#{fmt} -Gdpi=#{dpi'} -o "#{oFigurePath}" "#{oScriptPath}"|]
+ -- Specifying a DPI when the output format is SVG crops the final figure
+ -- See issue #40
+ -- TODO: does this also affect other vector formats like EPS?
+ dpi' = if saveFormat oFigureSpec == SVG then mempty else [st|-Gdpi=#{dpi oFigureSpec}|]
+ in [st|#{pathToExe oExecutable} #{cmdargs} -T#{fmt} #{dpi'} -o "#{oFigurePath}" "#{oScriptPath}"|]
-- Graphviz export is entirely based on command-line arguments
-- so there is no need to modify the script itself.