DocTestSetup = quote
using PGFPlotsX
end
The following types are accepted as elements of [Axis
& friends](@ref axislike):
-
legend specifications:
Legend
,LegendEntry
, -
[strings](@ref latex_code_strings), which are inserted verbatim.
This section documents these.
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](@ref Data).
!!! 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.
For \addplot
and \addplot+
, respectively.
Plot
PlotInc
Example:
julia> p = @pgf PlotInc({ blue }, Table("plotdata/invcum.dat"));
julia> print_tex(p)
\addplot+[blue]
table {plotdata/invcum.dat};
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
.
Plot3
Plot3Inc
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)
}
;
Legend
LegendEntry
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}}
HLine
and VLine
have no equivalent constructs in pgfplots
, they are provided for convenient drawing of horizontal and vertical lines. When options are used, they are passed to the TikZ function \draw[...]
.
HLine
VLine
HBand
and VBand
have no equivalent constructs in pgfplots
, they are provided for convenient drawing of horizontal and vertical bands. These bands are simply rectangles that span across an axis. When options are used, they are passed to the TikZ function \draw[...]
.
HBand
VBand
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.
[The gallery](@ref latex-code) has some detailed examples, eg for annotating plots.