pandoc-plot: A Pandoc filter to include figures generated from code blocks using your plotting toolkit of choice.

[ gpl, library, program, text ] [ Propose Tags ]

A Pandoc filter to include figures generated from code blocks. Keep the document and code in the same location. Output is captured and included as a figure.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.2.0.0, 0.2.1.0, 0.2.2.0, 0.3.0.0, 0.4.0.0, 0.4.0.1, 0.5.0.0, 0.6.0.0, 0.6.1.0, 0.7.0.0, 0.7.1.0, 0.7.2.0, 0.7.2.1, 0.8.0.0, 0.8.1.0, 0.9.0.0, 0.9.1.0, 0.9.2.0, 0.9.3.0, 0.9.4.0, 1.0.0.0, 1.0.1.0, 1.0.2.0, 1.0.2.1, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.3.0, 1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.8.0 (info)
Change log CHANGELOG.md
Dependencies aeson (>=2 && <3), base (>=4.11 && <5), bytestring, containers, data-default, directory (>=1.2.7 && <2), filepath (>=1.4 && <2), gitrev (>=1 && <2), hashable (>=1 && <2), lifted-async (>=0.10 && <1), lifted-base (>=0.2 && <1), mtl (>=2.2 && <3), optparse-applicative (>=0.14 && <0.19), pandoc (>=3 && <4), pandoc-plot, pandoc-types (>=1.23 && <1.24), shakespeare (>=2.0 && <3), tagsoup (>=0.14 && <1), template-haskell (>2.7 && <3), text (>=1 && <3), typed-process (>=0.2.1 && <1), unix (>=2.4 && <2.9), yaml (>=0.8 && <1) [details]
License GPL-2.0-or-later
Copyright (c) 2019-present Laurent P. René de Cotret
Author Laurent P. René de Cotret
Maintainer Laurent P. René de Cotret
Category Text
Home page https://github.com/LaurentRDC/pandoc-plot#readme
Bug tracker https://github.com/LaurentRDC/pandoc-plot/issues
Source repo head: git clone https://github.com/LaurentRDC/pandoc-plot
Uploaded by LaurentRDC at 2023-10-25T16:59:46Z
Distributions LTSHaskell:1.8.0, NixOS:1.8.0, Stackage:1.8.0
Executables pandoc-plot
Downloads 10484 total (86 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-10-25 [all 1 reports]

Readme for pandoc-plot-1.8.0

[back to package description]

pandoc-plot

A Pandoc filter to generate figures from code blocks in documents

license

pandoc-plot turns code blocks present in your documents (Markdown, LaTeX, etc.) into embedded figures, using your plotting toolkit of choice, including Matplotlib, ggplot2, MATLAB, Mathematica, and more.

Overview

This program is a Pandoc filter. It can therefore be used in the middle of conversion from input format to output format, replacing code blocks with figures.

The filter recognizes code blocks with classes that match plotting toolkits. For example, using the matplotlib toolkit:

# My document

This is a paragraph.

```{.matplotlib}
import matplotlib.pyplot as plt

plt.figure()
plt.plot([0,1,2,3,4], [1,2,3,4,5])
plt.title('This is an example figure')
```

Putting the above in input.md, we can then generate the plot and embed it in an HTML page:

pandoc --filter pandoc-plot input.md --output output.html

The resulting output.html looks like this:

<h1 id="my-document">My document</h1>

<p>This is a paragraph.</p>

<figure>
<img src="plots\9671478262050082276.png" />
</figure>

Supported toolkits

pandoc-plot currently supports the following plotting toolkits (installed separately):

  • matplotlib: plots using the matplotlib Python library;
  • plotly_python : plots using the plotly Python library;
  • plotly_r: plots using the plotly R library
  • matlabplot: plots using MATLAB;
  • mathplot : plots using Mathematica;
  • octaveplot: plots using GNU Octave;
  • ggplot2: plots using ggplot2;
  • gnuplot: plots using gnuplot;
  • graphviz: graphs using Graphviz;
  • bokeh: plots using the Bokeh visualization library;
  • plotsjl: plots using the Julia Plots.jl package;
  • plantuml: diagrams using the PlantUML software suite;
  • sageplot: plots using the Sage software system;
  • d2: plots using D2;
  • asymptote: plots using Asymptote.

To know which toolkits are useable on your machine (and which ones are not available), you can check with the toolkits command:

pandoc-plot toolkits

Wish your plotting toolkit of choice was available? Please raise an issue!

Documentation

You can find more information in the documentation, available either in the source repository file MANUAL.md, on the webpage, or via the command pandoc-plot --manual.

Installation

Binaries and Installers

Latest release

Windows, Linux, and Mac OS binaries are available on the GitHub release page. There are also Windows installers.

conda

Conda Version

Like pandoc, pandoc-plot is available as a package installable with conda. Click here to see the package page.

To install in the current environment:

conda install -c conda-forge pandoc-plot

Homebrew

homebrew version

pandoc-plot is available as a package via Homebrew. Click here to see the package page.

To install:

brew install pandoc-plot

winget

You can install pandoc-plot from the Windows Package Manager winget (just like pandoc). To install:

winget install pandoc-plot

Arch Linux

AUR version

You can install pandoc-plot from the archlinux user repository as pandoc-plot-bin. You can install using e.g. yay:

yay -S pandoc-plot-bin

From Hackage/Stackage

Hackage version

pandoc-plot is available on Hackage and Stackage. Using the cabal-install tool:

cabal update
cabal install

From source

Building from source can be done using cabal:

git clone https://github.com/LaurentRDC/pandoc-plot
cd pandoc-plot
cabal install # Alternatively, `stack install`