PGFPlotsX.jl - Plotting with LaTeX, directly from Julia
07-29, 19:40–19:50 (UTC), Red

PGFPlots is a plotting package for LaTeX that produces plots with vector graphics and interfaces with the math typesetting of LaTeX. PGFPlotsX.jl is a Julia plotting package that provides an interface to PGFPlots by transpiling Julia objects to LaTeX code. Furthermore, the figures generated by PGFPlotsX.jl are directly rendered in IPython notebooks, Pluto and VSCode which allows for rapid plot prototyping. It also serves as one of the backends to the popular Plots.jl package.


Some people like to almost endlessly tinker with their plots and the LaTeX plot package PGFPlots is one of the plotting packages that allow for such tinkering. It comes with a 600-page manual describing an almost endless number of dials and levers that can be turned and pulled to finally get the perfect plot. One of its drawbacks is that coding in LaTeX can be argued to be quite unpleasant. The error messages are often not good and there is very little linting support. PGFPlots.jl is a Julia package that brings all the good things about PGFPlots into Julia while remedying the bad part by allowing one to use Julia for the coding part.

One of the big design goals of the package was to facilitate "translatability" of LaTeX PGFPlots code into Julia over, for example, terseness. This was based on the observation that many plots are created by "stitching together" parts of different examples that can be found scattered over the internet. Allowing LaTeX PGFPlots code to easily be brought into Julia would open up a big amount of example code to be used. It also means that the official PGFPlots manual largely acts as a manual for the package.

Even though the API is made to resemble the one in LaTeX it is of a much higher level than the LaTeX counterpart. Many Julia objects can be directly used as inputs to the plot and will "convert" in a predictable way. Some examples of plottable Julia objects include data frames (from DataFrames.jl), contours (from Contours.jl), colors (from Colors.jl), error bars (from Measurements.jl).

For people that desire a terser coding style while still having easy access to the PGFPlots renderer, it is possible to use PGFPlotsX.jl as a backend to Plots.jl.

In this talk, I will discuss how the design goals outlined above were achieved and give some illustrative examples and use cases. Attendees should get an overview of the package and be able to determine if using the package for their daily plotting is suitable.

I'm a contributor to the Julia language and many packages.

This speaker also appears in: