summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.closingplots.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.closingplots.tex')
-rw-r--r--Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.closingplots.tex35
1 files changed, 35 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.closingplots.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.closingplots.tex
new file mode 100644
index 00000000000..d201284ac15
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.closingplots.tex
@@ -0,0 +1,35 @@
+
+
+\subsection{Closing Plots (Filling the Area Under Plots)}
+\begin{command}{\closedcycle}
+ Provide |\closedcycle| as \meta{trailing path commands} after |\addplot| to draw a closed line from the last plot coordinate to the first one.
+
+ Use |\closedcycle| whenevery you intend to fill the area under a plot.
+
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \begin{axis}
+ \addplot {x^2+2} \closedcycle;
+ \end{axis}
+\end{tikzpicture}
+\end{codeexample}
+
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \begin{axis}
+ \addplot+[fill] {x^2+2} \closedcycle;
+ \end{axis}
+\end{tikzpicture}
+\end{codeexample}
+ In case of stacked plots, |\closedcycle| connects the current plot with the previous plot instead of connecting with the $x$~axis\footnote{The implementation for stacked plots requires some additional logic to determine the filled area: \lstinline{\\closedcycle} will produce a \texttt{plot coordinates} command with \emph{reversed} coordinates of the previous plot. This is usually irrelevant for end users, but it assumes that the plot's type is symmetric. Since constant plots are inherently unsymmetric, \lstinline{\\closedcycle} will use \texttt{const plot mark right} as reversed sequence for \texttt{const plot mark left}.}.
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \begin{axis}[stack plots=y]
+ \addplot+[fill] coordinates
+ {(0,1) (1,1) (2,2) (3,2)} \closedcycle;
+ \addplot+[fill] coordinates
+ {(0,1) (1,1) (2,2) (3,2)} \closedcycle;
+ \end{axis}
+\end{tikzpicture}
+\end{codeexample}
+\end{command}