diff options
author | Laurent René de Cotret <l.rdc@socivolta.com> | 2022-07-03 07:43:59 -0400 |
---|---|---|
committer | Laurent René de Cotret <l.rdc@socivolta.com> | 2022-07-03 07:43:59 -0400 |
commit | cc689d6a65d42a99dbb6d0ed91cd1437a9f367bb (patch) | |
tree | 4981bf2924229433b04f34b763a5e0598c2efc4d | |
parent | 933daba593196bf3b1ae1f2022d17389552f275c (diff) |
Fixed an issue where graphviz plots in vector format were cropped when a DPI was specified (#40)1.5.4
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | pandoc-plot.cabal | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Filter/Plot/Renderers/Graphviz.hs | 7 |
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. |