Skip to content

Commit cc689d6

Browse files
committed
Fixed an issue where graphviz plots in vector format were cropped when a DPI was specified (#40)
1 parent 933daba commit cc689d6

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
pandoc-plot uses [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
44

5+
## Release 1.5.4
6+
7+
* Fixed an issue where graphviz plots in vector format were cropped when a DPI was specified (#40).
8+
59
## Release 1.5.3
610

7-
* Fixed an issue where the `tight_bbox` option for Matplotlib plots was ignored (#48)
11+
* Fixed an issue where the `tight_bbox` option for Matplotlib plots was ignored (#48).
812

913
## Release 1.5.2
1014

pandoc-plot.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.2
22
name: pandoc-plot
3-
version: 1.5.3
3+
version: 1.5.4
44
synopsis: A Pandoc filter to include figures generated from code blocks using your plotting toolkit of choice.
55
description: A Pandoc filter to include figures generated from code blocks.
66
Keep the document and code in the same location. Output is

src/Text/Pandoc/Filter/Plot/Renderers/Graphviz.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ graphvizSupportedSaveFormats = [PNG, PDF, SVG, JPG, EPS, WEBP, GIF]
4343
graphvizCommand :: Text -> OutputSpec -> Text
4444
graphvizCommand cmdargs OutputSpec {..} =
4545
let fmt = fmap toLower . show . saveFormat $ oFigureSpec
46-
dpi' = dpi oFigureSpec
47-
in [st|#{pathToExe oExecutable} #{cmdargs} -T#{fmt} -Gdpi=#{dpi'} -o "#{oFigurePath}" "#{oScriptPath}"|]
46+
-- Specifying a DPI when the output format is SVG crops the final figure
47+
-- See issue #40
48+
-- TODO: does this also affect other vector formats like EPS?
49+
dpi' = if saveFormat oFigureSpec == SVG then mempty else [st|-Gdpi=#{dpi oFigureSpec}|]
50+
in [st|#{pathToExe oExecutable} #{cmdargs} -T#{fmt} #{dpi'} -o "#{oFigurePath}" "#{oScriptPath}"|]
4851

4952
-- Graphviz export is entirely based on command-line arguments
5053
-- so there is no need to modify the script itself.

0 commit comments

Comments
 (0)