packages feed

pandoc-pyplot 2.1.5.0 → 2.1.5.1

raw patch · 4 files changed

+14/−7 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -2,6 +2,11 @@ 
 pandoc-pyplot uses [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
 
+Release 2.1.5.1
+---------------
+
+* Fixed an issue where setting the configuration option `transparent: true`  left high-resolution figures difficult to see. Therefore, the option `transparent: true` does not affect high-resolution figures anymore.
+
 Release 2.1.5.0
 ---------------
 
README.md view
@@ -250,8 +250,8 @@ 
 * `interpreter` is the name of the interpreter to use. For example, `interpreter: python36`;
 * `flags` is a list of strings, which are flags that are passed to the python interpreter. For example, `flags: [-O, -Wignore]`;
-* `tight_bbox` is a boolean that determines whether to use `bbox_inches="tight"` or not when saving Matplotlib figures. For example, `tight_bbox: true`. See [here](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.savefig.html) for details;
-* `transparent` is a boolean that determines whether to make figure background transparent or not. This is useful, for example, for displaying a plot on top of a colored background on a web page. For example, `transparent: true`.
+* (*New in version 2.1.5.0*) `tight_bbox` is a boolean that determines whether to use `bbox_inches="tight"` or not when saving Matplotlib figures. For example, `tight_bbox: true`. See [here](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.savefig.html) for details;
+* (*New in version 2.1.5.0*) `transparent` is a boolean that determines whether to make figure background transparent or not. This is useful, for example, for displaying a plot on top of a colored background on a web page. High-resolution figures are not affected. For example, `transparent: true`.
 
 ## Installation
 
pandoc-pyplot.cabal view
@@ -1,5 +1,5 @@ name:           pandoc-pyplot
-version:        2.1.5.0
+version:        2.1.5.1
 cabal-version:  >= 1.12
 synopsis:       A Pandoc filter to include figures generated from Python code blocks
 description:    A Pandoc filter to include figures generated from Python code blocks. Keep the document and Python code in the same location. Output from Matplotlib is captured and included as a figure.
src/Text/Pandoc/Filter/Pyplot/FigureSpec.hs view
@@ -126,13 +126,15 @@     mconcat
         [ script spec
         , "\nimport matplotlib.pyplot as plt" -- Just in case
-        , plotCapture (figurePath spec) (dpi spec)
-        , plotCapture (hiresFigurePath spec) (minimum [200, 2 * dpi spec])
+        -- Note that the high-resolution figure always has non-transparent background
+        -- because it is difficult to see the image when opened directly 
+        -- in Chrome, for example.
+        , plotCapture (figurePath spec) (dpi spec) (transparent spec)
+        , plotCapture (hiresFigurePath spec) (minimum [200, 2 * dpi spec]) False
         ]
   where
     tight' = tightBbox spec
-    transparent' = transparent spec
-    plotCapture fname' dpi' = mconcat $ 
+    plotCapture fname' dpi' transparent' = mconcat $ 
         [ "\nplt.savefig("
         , T.pack $ show fname' -- show is required for quotes
         , ", dpi="