Axis elements

Axis elements

The following types are accepted as elements of Axis & friends:

This section documents these.

Plots

A plot is an element inside an axis. It can be a wide range of constructs, from a simple line to a 3D surface. A plot is created by wrapping one of the data structures.

Note

PGFPlots uses \addplot & friends for visualization that uses a single data source, in most cases drawn using the same style. If you want to plot multiple sources of data that share axes, eg two time series, your axis will have multiple “plots” in the terminology of PGFPlots.

Plot and PlotInc

For \addplot and \addplot+, respectively.

PGFPlotsX.PlotType.
struct Plot <: PGFPlotsX.OptionType

Corresponds to the \addplot[3][+] family of pgfplot commands.

Instead of the default constructor, use Plot([options], data, trailing...) and similar (PlotInc, Plot3, Plot3Inc) in user code.

source
PGFPlotsX.PlotIncFunction.
PlotInc([options::Options], data, trailing...)

Corresponds to the \addplot+ form in PGFPlots.

For the interpretation of the other arguments, see Plot(::Options, ::PlotData, ...).

source

Example:

julia> p = @pgf PlotInc({ blue }, Table("plotdata/invcum.dat"));

julia> print_tex(p)
\addplot+[blue]
    table {plotdata/invcum.dat};

Plot3

Plot3 will use the \addplot3 command instead of \addplot to draw 3D graphics. Otherwise it works the same as Plot. The incremental variant is Plot3Inc.

PGFPlotsX.Plot3Function.
Plot3([options::Options], data, trailing...)

Corresponds to the \addplot3 form in PGFPlots.

For the interpretation of the other arguments, see Plot(::Options, ::PlotData, ...).

source
PGFPlotsX.Plot3IncFunction.
Plot3Inc([options::Options], data, trailing...)

Corresponds to the \addplot3+ form in PGFPlots.

For the interpretation of the other arguments, see Plot(::Options, ::PlotData, ...).

source

Example:

julia> x, y, z = [1, 2, 3], [2, 4, 8], [3, 9, 27];

julia> p = @pgf Plot3({ very_thick }, Coordinates(x, y, z));

julia> print_tex(p)
\addplot3[very thick]
    coordinates {
        (1, 2, 3)
        (2, 4, 9)
        (3, 8, 27)
    }
    ;

Legends

Legend(labels)

Corresponds to \legend{ ... } in PGFPlots. Specifies multiple legends for an axis, its position is irrelevant.

labels are wrapped in {}s, so they can contain ,.

source
LegendEntry([options::Options], name, [isexpanded])

Corresponds to the \addlegendentry and \addlegendentryexpanded forms of PGFPlots.

source

A Legend can be used to add legends to an axis, for multiple plots at the same time. In contrast, LegendEntry applies to the preceding plot.

Example:

julia> print_tex(Legend(["Plot A", "Plot B"]))
\legend{{Plot A}, {Plot B}}

Using LaTeX code directly

In case there is no type defined in this package for some construct, you can use a String in an axis, and it is inserted verbatim into the generated LaTeX code. Raw string literals and the package LaTeXStrings are useful to avoid a lot of escaping.