Home

PGFPlotsX

Introduction

PGFPlotsX is a Julia package for creating publication quality figures using the LaTeX library PGFPlots as the backend. PGFPlots has extensive documentation (pdf) and a rich database of answered questions on places like stack overflow and tex.stackexchange. In order to take advantage of this, the syntax in PGFPlotsX is similar to the one written in tex. It is therefore, usually, easy to translate a PGFPlots example written in tex to PGFPlotsX Julia code. The advantage of using PGFPlotsX.jl over writing raw LaTeX code is that it is possible to use Julia objects directly in the figures. Furthermore, the figures can be previewed in notebooks and IDE's, like julia-vscode and Atom-Juno. It is, for example, possible to directly use a DataFrame from DataFrames.jl as a PGFPlots table.

Note

In this manual, “PGFPlots” refers to the LaTeX package, its constructs and syntax.

Installation

Pkg.add("PGFPlotsX")

PGFPlots.jl requires a LaTeX installation with the PGFPlots package installed. We recommend using a LaTeX installation with access to lualatex since it can have significantly better performance over pdflatex.

To generate or preview figures in svg (like is done by default in Jupyter notebooks) pdf2svg is required. This can obtained by, on Ubuntu, running sudo apt-get install pdf2svg, on RHEL/Fedora sudo dnf install pdf2svg and on macOS e.g. brew install pdf2svg. On Windows, the binary can be downloaded from here; be sure to add pdf2svg to the PATH.

For png figures pdftoppm is required. This should by default on Linux and on macOS should be available after running brew install poppler. It is also available in the Xpdf tools archive.

Note

If you installed a new LaTeX engine, pdf2svg or pdftoppm after you installed PGFPlotsX you need to run Pkg.build("PGFPlotsX") for this to be reflected. The output from Pkg.build should tell you what LaTeX engines and figure-converters it finds.