Figures are shown in
svg format when evaluated in Jupyter or Juno. For this you need the
pdf2svg software installed. If you want to show figures in
png format (because perhaps the svg format is too large), you can use
display("image/png", p) where
p is the figure to show. In Juno, if you are on macOS and there are problems finding the latex executable, see this issue. Starting Atom from the terminal seems to work around it.
In the REPL, the figure will be exported to a
Figures can be exported to files using
pgfsave(filename::AbstractString, figure; include_preamble::Bool = true, dpi = 150)
where the file extension of
filename determines the file type (can be
tex, or the standalone
tikz file extensions below),
include_preamble sets if the preamble should be included in the output (only relevant for
tex export) and
dpi determines the dpi of the figure (only relevant for
save(filename, td; include_preamble, latex_engine, buildflags, dpi, showing_ide)
Save the argument (either
TikzDocument, or some other type which is wrapped in one automatically, eg
filename, guessing the format from the file extension. Keywords specify options, some specific to some output formats.
pgfsave is an alias which is exported.
The standalone file extensions
PGF save LaTeX code for a
tikzpicture environment without a preamble. You can
\input them directly into a LaTeX document, or use the the tikzscale LaTeX package for using
\includegraphics with possible size adjustments.
You can use the externalization feature of
pgfplots, which caches generated
in the preamble of the LaTeX document which uses these plots, see the manuals for more details.
It is common to use a custom preamble to add user-defined macros or use different packages. There are a few ways to do this:
push!strings into the global variable
PGFPlotsX.CUSTOM_PREAMBLE. Each string in that vector will be inserted in the preamble.
custom_preamble.texfile in the
depsfolder of the directory of the package. This file is directly spliced into the preamble of the output.
Define the environment variable
PGFPLOTSX_PREAMBLE_PATHto a path pointing to a preamble file. The content of that will be inserted into the preamble.
A vector of stings, added after
Use this for additional definitions
\usepackage statements required by the LaTeX code you include into plots.
Access to the class options of the standalone document class is possible with
List of class options used in the preamble (default
PGFPlotsX.CLASS_OPTIONS = "varwidth"; push!(PGFPlotsX.CLASS_OPTIONS, "crop=false") the preamble will contain
See https://www.ctan.org/pkg/standalone for a list of options.
Thee are two different choices for latex engines,
LUALATEX. By default,
LUALATEX is used if it was available during
Pkg.build(). The active engine can be retrieved with the
latexengine() function and be set with
engine is one of the two previously mentioned engines (e.g.
Custom flags to the engine can be used in the latex command by
push!-ing them into the global variable