Manual for Package pgfplots
2D/3D Plots in LATeX, Version 1.18.1
http://sourceforge.net/projects/pgfplots
The Reference
4.18Style Options
4.18.1All Supported Styles¶
pgfplots provides many styles to customize its appearance and behavior. They can be defined and changed in any place where keys are allowed. Furthermore, own styles are defined easily.
-
Key handler key/.style={key-value-list} ¶
Defines or redefines a style key. A style is a normal key which will set all options in key-value-list when it is set.
Use \pgfplotsset{key/.style={key-value-list}} to (re)define a style key in the namespace /pgfplots.
-
Key handler key/.append style={key-value-list} ¶
Appends key-value-list to an already existing style key. This is the preferred method to change the predefined styles: if you only append, you maintain compatibility with future versions.
Use \pgfplotsset{key/.append style={key-value-list}} to append key-value-list to the style key. This will assume the prefix /pgfplots.
Styles installed for linear/logarithmic axis
-
/pgfplots/every axis(style, initially empty) ¶
Installed at the beginning of every axis. TikZ options inside of it will be used for anything inside of the axis rectangle and any axis descriptions.
-
/pgfplots/every axis post(style, initially empty) ¶
A style which is applied right after arguments provided to an axis are processed.
In the following example, such a style is used to override the xmin and xmax options provided as arguments to \begin{axis}[...]:
It is processed right after the arguments of \begin{axis}, but before styles like yticklabel style etc. are evaluated.
-
/pgfplots/every semilogx axis(style, initially empty) ¶
Installed at the beginning of every plot with logarithmic \(x\)-axis and linear \(y\)-axis, but after ‘every axis’.
-
/pgfplots/every semilogy axis(style, initially empty) ¶
-
/pgfplots/every loglog axis(style, initially empty) ¶
-
/pgfplots/every linear axis(style, initially empty) ¶
Installed at the beginning of every plot with normal axis scaling.
Styles installed for single plots
-
/pgfplots/every axis plot(style, initially empty) ¶
Installed for each plot. This style may contain options like samples, gnuplot parameters, error bars and it may contain options which affect the final drawing commands.
-
/pgfplots/every axis plot post(style, initially empty)
This style is similar to every axis plot in that is applies to any drawing command in \addplot. However, it is set after any user defined styles or cycle list options.
-
/pgfplots/every axis plot no #(style, initially empty) ¶
Used for every #th plot where \(\#=0,1,2,3,4,\dotsc \).
This style is installed before the argument list of \addplotoptions, i.e. options are preferred. Note that this also means that any items in a cycle list have higher priority.
-
/pgfplots/every forget plot(style, initially empty) ¶
Used for every plot which has forget plot activated.
-
/pgfplots/forget plot style={key-value-list} ¶
An abbreviation for every forget plot/.append style={key-value-list}.
It appends options to the already existing style every forget plot.
Styles for axis descriptions
-
/pgfplots/label style={key-value-list} ¶
An abbreviation for every axis label/.append style={key-value-list}.
It appends options to the already existing style every axis label.
-
/pgfplots/every axis x label(style, no value) ¶
-
/pgfplots/every axis y label(style, no value) ¶
-
/pgfplots/every axis z label(style, no value) ¶
Used only for \(x\), \(y\), or \(z\) labels, respectively and installed after ‘every axis label’.
The initial settings are set by xlabel absolute and its variants (if the initial configuration compat=pre 1.3 is active) or xlabel near ticks which provides the better spacing as it incorporates the tick label sizes to compute the position.
These styles will be overwritten by axis x line and/or axis y line. Please remember to place your modifications after the axis line variations.
-
/pgfplots/x label style={key-value-list} ¶
-
/pgfplots/y label style={key-value-list} ¶
-
/pgfplots/z label style={key-value-list} ¶
-
/pgfplots/xlabel style={key-value-list} ¶
-
/pgfplots/ylabel style={key-value-list} ¶
-
/pgfplots/zlabel style={key-value-list} ¶
Different abbreviations for every axis x label/.append style={key-value-list} (or the respective styles for y, every axis y label/.append style={key-value-list}, and z, every axis z label/.append style={key-value-list}).
-
/pgfplots/every axis title(style, no value) ¶
-
/pgfplots/every axis title shift={default shift} (initially 6pt) ¶
Used for any axis title. The at=(x,y) syntax will place the title using axis description cs.
The initial setting is
To be more precise, the yshift doesn’t use the hardcoded 6pt: it uses the value of
which can be reset if needed.
-
/pgfplots/title style={key-value-list} ¶
An abbreviation for every axis title/.append style={key-value-list}.
It appends options to the already existing style every axis title.
-
/pgfplots/every axis legend(style, no value)
Installed for each legend. As described for axis description cs, the legend’s position can be placed using coordinates between \(0\) and \(1\) (it employs axis description cs automatically).
The initial setting is
-
/pgfplots/legend style={key-value-list}
An abbreviation for every axis legend/.append style={key-value-list}.
It appends options to the already existing style every axis legend.
-
/pgfplots/every legend image post(style, no value)
Allows to change the appearance of the small legend images after the options of the plot style have been applied. Thus, legend formatting can be changed independently of the plot style using every legend image post.
This key is also documented on page (page for section 4.9.5).
-
/pgfplots/legend image post style={key-value-list}
An abbreviation for every legend image post/.append style={key-value-list}.
It appends options to the already existing style every legend image post.
-
/pgfplots/every colorbar(style, no value)
A style to change the colorbar. See page (page for section 4.9.13) for the reference documentation of every colorbar.
-
/pgfplots/colorbar style={key-value-list}
An abbreviation for every colorbar/.append style={key-value-list}.
It appends options to the already existing style every colorbar.
Styles for axis lines
-
/pgfplots/every outer x axis line(style, initially empty)
-
/pgfplots/every outer y axis line(style, initially empty)
-
/pgfplots/every outer z axis line(style, initially empty)
Installed for every axis line which lies on the outer box.
If you want arrow heads, you may also need to check the separate axis lines boolean key.
-
/pgfplots/axis line style={key-value-list}
-
/pgfplots/inner axis line style={key-value-list}
-
/pgfplots/outer axis line style={key-value-list}
-
/pgfplots/x axis line style={key-value-list}
-
/pgfplots/y axis line style={key-value-list}
-
/pgfplots/z axis line style={key-value-list}
These options modify parts of the axis line styles. They append options to every inner x axis line and every outer x axis line and the respective \(y\)/\(z\) variants.
Please refer to Section 4.9.9 on page (??) for details about styles for axis lines.
-
/pgfplots/3d box foreground style={key-value-list} ¶
An abbreviation for every 3d box foreground/.append style={key-value-list}.
It appends options to the already existing style every 3d box foreground.
-
/pgfplots/every colorbar sampled line(style, no value)
To be used in conjunction with colorbar sampled line, see the documentation therein.
-
/pgfplots/colorbar sampled line style={key-value-list} ¶
An abbreviation for every colorbar sampled line/.append style={key-value-list}.
It appends options to the already existing style every colorbar sampled line.
Styles for ticks
-
/pgfplots/every tick(style, initially very thin,gray) ¶
-
/pgfplots/tick style={key-value-list} ¶
An abbreviation for every tick/.append style={key-value-list}.
It appends options to the already existing style every tick.
-
/pgfplots/every minor tick(style, initially empty) ¶
Used for each minor tick line, installed after ‘every tick’.
-
/pgfplots/minor tick style={key-value-list} ¶
An abbreviation for every minor tick/.append style={key-value-list}.
It appends options to the already existing style every minor tick.
-
/pgfplots/every major tick(style, initially empty) ¶
Used for each major tick line, installed after ‘every tick’.
-
/pgfplots/major tick style={key-value-list} ¶
An abbreviation for every major tick/.append style={key-value-list}.
It appends options to the already existing style every major tick.
-
/pgfplots/every tick label(style, initially empty) ¶
-
/pgfplots/tick label style={key-value-list} ¶
-
/pgfplots/ticklabel style={key-value-list} ¶
Different abbreviations for every tick label/.append style={key-value-list} (or the respective styles for y, every tick label/.append style={key-value-list}, and z, every tick label/.append style={key-value-list}).
-
/pgfplots/every x tick label(style, initially empty) ¶
-
/pgfplots/every y tick label(style, initially empty) ¶
-
/pgfplots/every z tick label(style, initially empty) ¶
Used for each \(x\) (or \(y\) or \(z\), respectively) tick label, installed after ‘every tick label’.
-
/pgfplots/x tick label style={key-value-list} ¶
-
/pgfplots/y tick label style={key-value-list} ¶
-
/pgfplots/z tick label style={key-value-list} ¶
-
/pgfplots/xticklabel style={key-value-list} ¶
-
/pgfplots/yticklabel style={key-value-list} ¶
-
/pgfplots/zticklabel style={key-value-list} ¶
Different abbreviations for every x tick label/.append style={key-value-list} (or the respective styles for y, every y tick label/.append style={key-value-list}, and z, every z tick label/.append style={key-value-list}).
-
/pgfplots/every x tick scale label(style, no value) ¶
-
/pgfplots/every y tick scale label(style, no value) ¶
-
/pgfplots/every z tick scale label(style, no value) ¶
Configures placement and display of the nodes containing the order of magnitude of tick labels, see Section 4.15.3 for more information about scaled ticks.
The initial settings with compat=1.8 or higher are
-
/pgfplots/x tick scale label style={key-value-list} ¶
-
/pgfplots/y tick scale label style={key-value-list} ¶
-
/pgfplots/z tick scale label style={key-value-list} ¶
An abbreviation for every x tick scale label/.append style={key-value-list} (or the respective styles for y, every y tick scale label/.append style={key-value-list}, and the z-axis, every z tick scale label/.append style={key-value-list}).
It appends options to the already existing style every x tick scale label.
-
/pgfplots/xtick style={key-value-list} ¶
-
/pgfplots/ytick style={key-value-list} ¶
-
/pgfplots/ztick style={key-value-list} ¶
An abbreviation for every x tick/.append style={key-value-list} (or the respective styles for y, every y tick/.append style={key-value-list}, and the z-axis, every z tick/.append style={key-value-list}).
It appends options to the already existing style every x tick.
-
/pgfplots/minor x tick style={key-value-list} ¶
-
/pgfplots/minor y tick style={key-value-list} ¶
-
/pgfplots/minor z tick style={key-value-list} ¶
An abbreviation for every minor x tick/.append style={key-value-list} (or the respective styles for y, every minor y tick/.append style={key-value-list}, and the z-axis, every minor z tick/.append style={key-value-list}).
It appends options to the already existing style every minor x tick.
-
/pgfplots/major x tick style={key-value-list} ¶
-
/pgfplots/major y tick style={key-value-list} ¶
-
/pgfplots/major z tick style={key-value-list} ¶
An abbreviation for every major x tick/.append style={key-value-list} (or the respective styles for y, every major y tick/.append style={key-value-list}, and the z-axis, every major z tick/.append style={key-value-list}).
It appends options to the already existing style every major x tick.
-
/pgfplots/every extra x tick(style, no value) ¶
-
/pgfplots/every extra y tick(style, no value) ¶
-
/pgfplots/every extra z tick(style, no value) ¶
Allows to configure the appearance of ‘extra x ticks’. This style is installed before touching the first extra \(x\) tick. It is possible to set any option which affects tick or grid line generation.
The initial setting is
Useful examples are shown below.
-
/pgfplots/extra x tick style={key-value-list} ¶
-
/pgfplots/extra y tick style={key-value-list} ¶
-
/pgfplots/extra z tick style={key-value-list} ¶
An abbreviation for every extra x tick/.append style={key-value-list} (or the respective styles for y, every extra y tick/.append style={key-value-list}, and the z-axis, every extra z tick/.append style={key-value-list}).
It appends options to the already existing style every extra x tick.
-
/pgfplots/extra tick style={key-value-list} ¶
An abbreviation which appends key-value-list to every extra x tick, every extra y tick and every extra z tick.
Styles for grid lines
-
/pgfplots/every axis grid(style, initially thin,black!25) ¶
-
/pgfplots/grid style={key-value-list} ¶
An abbreviation for every axis grid/.append style={key-value-list}.
It appends options to the already existing style every axis grid.
-
/pgfplots/every minor grid(style, initially empty) ¶
Used for each minor grid line, installed after ‘every axis grid’.
-
/pgfplots/minor grid style={key-value-list} ¶
An abbreviation for every minor grid/.append style={key-value-list}.
It appends options to the already existing style every minor grid.
-
/pgfplots/every major grid(style, initially empty) ¶
-
/pgfplots/major grid style={key-value-list} ¶
An abbreviation for every major grid/.append style={key-value-list}.
It appends options to the already existing style every major grid.
-
/pgfplots/x grid style={key-value-list} ¶
-
/pgfplots/y grid style={key-value-list} ¶
-
/pgfplots/z grid style={key-value-list} ¶
An abbreviation for every axis x grid/.append style={key-value-list} (or the respective styles for y, every axis y grid/.append style={key-value-list}, and the z-axis, every axis z grid/.append style={key-value-list}).
It appends options to the already existing style every axis x grid.
-
/pgfplots/minor x grid style={key-value-list} ¶
-
/pgfplots/minor y grid style={key-value-list} ¶
-
/pgfplots/minor z grid style={key-value-list} ¶
An abbreviation for every minor x grid/.append style={key-value-list} (or the respective styles for y, every minor y grid/.append style={key-value-list}, and the z-axis, every minor z grid/.append style={key-value-list}).
It appends options to the already existing style every minor x grid.
-
/pgfplots/major x grid style={key-value-list} ¶
-
/pgfplots/major y grid style={key-value-list} ¶
-
/pgfplots/major z grid style={key-value-list} ¶
An abbreviation for every major x grid/.append style={key-value-list} (or the respective styles for y, every major y grid/.append style={key-value-list}, and the z-axis, every major z grid/.append style={key-value-list}).
It appends options to the already existing style every major x grid.
Styles for error bars
-
/pgfplots/every error bar(style, initially thin) ¶
-
/pgfplots/error bars/error bar style={key-value-list}
An abbreviation for every error bar/.append style={key-value-list}.
It appends options to the already existing style every error bar.
4.18.2(Re)Defining Own Styles¶
Use \pgfplotsset{style name/.style={key-value-list}} to create own styles. If style name exists already, it will be replaced. Please note that it is not possible to use the TikZ command \tikzstyle{style name}=[] in this context.63