diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-plots.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-plots.tex | 90 |
1 files changed, 34 insertions, 56 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-plots.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-plots.tex index 95b59642c19..13d1ff21419 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-plots.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-plots.tex @@ -23,62 +23,11 @@ This section describes the |pgfbaseplot| package. \subsection{Overview} -\subsubsection{When Should One Use PGF for Generating Plots? } - -There exist many powerful programs that produce plots, examples are -\textsc{gnuplot} or \textsc{mathematica}. These programs can produce -two different kinds of output: First, they can output a complete plot -picture in a certain format (like \pdf) that includes all low-level -commands necessary for drawing the complete plot (including axes and -labels). Second, they can usually also produce ``just plain data'' in -the form of a long list of coordinates. Most of the powerful programs -consider it a to be ``a bit boring'' to just output tabled data and -very much prefer to produce fancy pictures. Nevertheless, when coaxed, -they can also provide the plain data. - -The plotting mechanism described in the following deals only with -plotting data given in the form of a list of coordinates. Thus, this -section is about using \pgfname\ to turn lists of coordinates into -plots. - -\emph{Note that is often not necessary to use \pgfname\ for this.} -Programs like \textsc{gnuplot} can produce very sophisticated plots -and it is usually much easier to simply include these plots as a -finished \textsc{pdf} or PostScript graphics. - -However, there are a number of reasons why you may wish to invest time -and energy into mastering the \pgfname\ commands for creating plots: - -\begin{itemize} -\item - Virtually all plots produced by ``external programs'' use different - fonts from the one used in your document. -\item - Even worse, formulas will look totally different, if they can be - rendered at all. -\item - Line width will usually be too large or too small. -\item - Scaling effects upon inclusion can create a mismatch between sizes - in the plot and sizes in the text. -\item - The automatic grid generated by most programs is mostly - distracting. -\item - The automatic ticks generated by most programs are cryptic - numerics. (Try adding a tick reading ``$\pi$'' at the right point.) -\item - Most programs make it very easy to create ``chart junk'' in a most - convenient fashion. All show, no content. -\item - Arrows and plot marks will almost never match the arrows used in the - rest of the document. -\end{itemize} - -The above list is not exhaustive, unfortunately. - - -\subsubsection{How PGF Handles Plots} +There are different reasons for using \pgfname\ for creating plots +rather than some more powerful program such as \textsc{gnuplot} or +\textsc{mathematica}, as discussed in +Section~\ref{section-why-pgname-for-plots}. So, let us assume that -- +for whatever reason -- you wish to use \pgfname\ for generating a plot. \pgfname\ (conceptually) uses a two-stage process for generating plots. First, a \emph{plot stream} must be produced. This stream @@ -211,6 +160,35 @@ should be used. However, it would not be terribly difficult to write a intelligently. +\begin{command}{\pgfplotfunction\marg{variable}\marg{sample list}\marg{point}} + This command will produce coordinates by iterating the + \meta{variable} over all values in \meta{sample list}, which should + be a list in the |\foreach| syntax. For each value of + \meta{variable}, the \meta{point} is evaluated and the resulting + coordinate is inserted into the plot stream. + +\begin{codeexample}[] +\begin{tikzpicture}[x=3.8cm/360] + \pgfplothandlerlineto + \pgfplotfunction{\x}{0,5,...,360}{\pgfpointxy{\x}{sin(\x)+sin(3*\x)}} + \pgfusepath{stroke} +\end{tikzpicture} +\end{codeexample} + +\begin{codeexample}[] +\begin{tikzpicture}[y=3cm/360] + \pgfplothandlerlineto + \pgfplotfunction{\y}{0,5,...,360}{\pgfpointxyz{sin(2*\y)}{\y}{cos(2*\y)}} + \pgfusepath{stroke} +\end{tikzpicture} +\end{codeexample} + + Be warnded that if the expressions that need to evaluated for each + point are complex, then this command can be very slow. +\end{command} + + + \begin{command}{\pgfplotgnuplot\oarg{prefix}\marg{function}} This command will ``try'' to call the \textsc{gnuplot} program to generate the coordinates of the \meta{function}. In detail, the |