Using LaTeX code

Using LaTeX code

PGFPlotsX has does not specify types for all LaTeX constructs. This is not a limitation, as you can just provide LaTeX code as strings, which are emitted directly. They can be freely mixed with other types, which are converted to LaTeX with print_tex. Since elements of AbstractVectors are printed in turn, this allows for a compact style.

Annotating plots

The example below demonstrates the use of \node. Note the following:

using Colors
x = vcat(randn(10) ./ 4, 2.0)
y = vcat(randn(10) ./ 4, 1.0)
@pgf Axis(
    {
        only_marks,
        xlabel = "x",
        ylabel = "y"
    },
    Plot(Table(x, y)),
    [raw"\node ",
     {
         draw = parse(Colorant, "tomato3"),
         pin = "180:outlier"
     },
     " at ",
     Coordinate(x[end], y[end]),
     "{};"])

[.pdf], [generated .tex]