diff options
author | Karl Berry <karl@freefriends.org> | 2011-07-26 23:26:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-07-26 23:26:28 +0000 |
commit | 792ab47701eef9ed7c77ca44fb642b53189aba33 (patch) | |
tree | 168b086ed1ee1a8d519040863defe2a6ab4bd8d5 /Master/texmf-dist/doc/latex/numericplots/BasicFunctionality.tex | |
parent | e2d56f5c45ad8c6d04d5b28277819d0d35ee1f1a (diff) |
numericplots (14jul11)
git-svn-id: svn://tug.org/texlive/trunk@23241 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/numericplots/BasicFunctionality.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/numericplots/BasicFunctionality.tex | 374 |
1 files changed, 308 insertions, 66 deletions
diff --git a/Master/texmf-dist/doc/latex/numericplots/BasicFunctionality.tex b/Master/texmf-dist/doc/latex/numericplots/BasicFunctionality.tex index b738a0e4789..3a9298b5f55 100644 --- a/Master/texmf-dist/doc/latex/numericplots/BasicFunctionality.tex +++ b/Master/texmf-dist/doc/latex/numericplots/BasicFunctionality.tex @@ -1,4 +1,4 @@ -% Copyright 2010 Thomas König, Alexander Michel +% Copyright 2010 Thomas Koenig, Alexander Michel % % This file is part of NumericPlots. % @@ -153,7 +153,7 @@ To plot multiple data in one plot call \newline {\IdentI} \listplot[style=StdLineStyB] {\IdentII} - + \putSE{\LegendDefinition{ \LegLine{style=StdLineStyA} & IdentI \\ \LegLine{style=StdLineStyB} & IdentII @@ -188,9 +188,9 @@ The commands \texttt{plotxAxis} and \texttt{plotyAxis} take the options \texttt{LabelOption} and \texttt{TickLabelOption} which may be used to eliminate or change the look of the labels. -Standard values for \texttt{LabelOption} and \texttt{TickLabelOption} may be set -by \verb|\newcommand{\StdLabelOption}{\color{blue}| and -\verb|\newcommand{\StdTickLabelOption}{\small}|. +Standard values for \texttt{LabelOption} and \texttt{TickLabelOption} may be set\\ +by \verb|\newcommand{\StdLabelOption}{\color{blue}|\\ +and \verb|\newcommand{\StdTickLabelOption}{\small}|. The option \texttt{xLabelSep} for \verb|\plotxAxis| (and \texttt{yLabelSep} for \verb|\plotyAxis|) may be used to set the seperation between the axis and the label. Standard value @@ -260,7 +260,7 @@ command NDPput, see the following example. \listplot[style=StdLineStyA] {\IdentI} - + % put some stuff somewhere \NDPput[x=1.2, y=75, RefPoint=br]{text} \NDPput[x=1.2, y=100]{$a^2$} @@ -269,8 +269,8 @@ command NDPput, see the following example. \NDPput[x=1.6, y=100]{\pnode{A}} \NDPput[x=1.8, y=150]{\pnode{B}} % ...and draw a line between them - \ncline{A}{B} - + \ncline{A}{B} + % or put the legend at a specific position \NDPput[x=1.8, y=75]{\LegendDefinition{ \LegLine{style=StdLineStyA} & IdentI @@ -292,7 +292,7 @@ command NDPput, see the following example. \listplot[style=StdLineStyA] {\IdentI} - + % put some stuff somewhere \NDPput[x=1.2, y=75, RefPoint=br]{text} \NDPput[x=1.2, y=100]{$a^2$} @@ -301,8 +301,8 @@ command NDPput, see the following example. \NDPput[x=1.6, y=100]{\pnode{A}} \NDPput[x=1.8, y=150]{\pnode{B}} % ...and draw a line between them - \ncline{A}{B} - + \ncline{A}{B} + % or put the legend at a specific position \NDPput[x=1.8, y=75]{\LegendDefinition{ \LegLine{style=StdLineStyA} & IdentI @@ -310,11 +310,33 @@ command NDPput, see the following example. \end{NumericDataPlot} \end{minipage} -Alternatively, stuff can be placed within the plot with \verb|\rput|. +For convenience the commands \verb|\putXX{object}| where +$XX\in\left(N,S,E,W,NW,NE,SW,SE\right)$ are defined to place something in the +North, South,\ldots, SouthEast corner of the plot. Also, the command +\verb|\putExpY{xx}| and \verb|\putExpX{xx}| may be used to place exponents at +the axes. \begin{minipage}[T]{0.5\linewidth} \begin{verbatim} \begin{NumericDataPlot} + ... + \putExpY{$\times 10^{-3}$} + \putExpX{$\times 10^{-6}$} + + \putN{N} + \putS{S} + \putW{W} + \putE{E} + \putNW{NW} + \putNE{NE} + \putSW{SW} + \putSE{SE} + \end{NumericDataPlot} + \end{verbatim} +\end{minipage} +\begin{minipage}[T]{0.5\linewidth} + \vspace{10pt} + \begin{NumericDataPlot} {\textwidth}{5cm} \setxAxis {xMin=1, xMax=1.6, Dx=0.2} @@ -326,7 +348,30 @@ Alternatively, stuff can be placed within the plot with \verb|\rput|. \listplot[style=StdLineStyA] {\IdentI} - + + \putExpY{$\times 10^{-3}$} + \putExpX{$\times 10^{-6}$} + + \putN{N} + \putS{S} + \putW{W} + \putE{E} + \putNW{NW} + \putNE{NE} + \putSW{SW} + \putSE{SE} + \end{NumericDataPlot} +\end{minipage} + + +Alternatively, stuff can be placed +within the plot with \verb|\rput|. + +\begin{minipage}[T]{0.5\linewidth} + \begin{verbatim} + \begin{NumericDataPlot} + ... + % put text in the middle of the plot \rput{45}(500,500){text} % put a formula in the lower left corner @@ -336,8 +381,8 @@ Alternatively, stuff can be placed within the plot with \verb|\rput|. \NDPput[x=1.2, y=125]{\pnode{A}} \rput(750,900){\Rnode{B}{peak}} % ...and draw a line between them - \ncline{<-}{A}{B} - + \ncline{<-}{A}{B} + % or put the legend at a specific position \rput{-45}(750,250){\LegendDefinition{ \LegLine{style=StdLineStyA} & IdentI @@ -359,7 +404,7 @@ Alternatively, stuff can be placed within the plot with \verb|\rput|. \listplot[style=StdLineStyA] {\IdentI} - + % put text in the middle of the plot \rput{45}(500,500){text} % put a formula in the lower left corner @@ -369,8 +414,8 @@ Alternatively, stuff can be placed within the plot with \verb|\rput|. \NDPput[x=1.2, y=125]{\pnode{A}} \rput(750,900){\Rnode{B}{peak}} % ...and draw a line between them - \ncline{<-}{A}{B} - + \ncline{<-}{A}{B} + % or put the legend at a specific position \rput{-45}(750,250){\LegendDefinition{ \LegLine{style=StdLineStyA} & IdentI @@ -380,7 +425,184 @@ Alternatively, stuff can be placed within the plot with \verb|\rput|. -\subsection{Line Styles} +% ================================= +% | | +% | Linestyles and colors | +% | | +% ================================= + +\subsection{Linestyles and colors} + +While using the package, there are predefined linestyles which may be used: + +\begin{minipage}{0.6\linewidth} + \centering + \small + + \input{DataTestRealData} + + \begin{NumericDataPlot}[]{\linewidth}{0.7\linewidth} + \setxAxis{xMin=2, xMax=17, xO=5, Dx=4} + \setyAxis{yMin=20, yMax=70, yO=20, Dy=20} + + \plotxAxis[NoLabel, AxisStyle=Boxed]{} + \plotyAxis[NoLabel, AxisStyle=Boxed]{} + + \listplot[style=StdLineStyA]{\DataA} + \listplot[style=StdLineStyB]{\DataB} + \listplot[style=StdLineStyC]{\DataC} + \listplot[style=StdLineStyD]{\DataD} + \listplot[style=StdLineStyE]{\DataE} + \listplot[style=StdLineStyF]{\DataF} + \listplot[style=StdLineStyG]{\DataG} + \end{NumericDataPlot} +\end{minipage} +\begin{minipage}{0.4\linewidth} + \centering + \LegendDefinition{ + \LegLine{style=StdLineStyA} & StdLineStyA \\ + \LegLine{style=StdLineStyB} & StdLineStyB \\ + \LegLine{style=StdLineStyC} & StdLineStyC \\ + \LegLine{style=StdLineStyD} & StdLineStyD \\ + \LegLine{style=StdLineStyE} & StdLineStyE \\ + \LegLine{style=StdLineStyF} & StdLineStyF \\ + \LegLine{style=StdLineStyG} & StdLineStyG \\ + } +\end{minipage} + +When using the package option \texttt{BW} the standard line styles will be +replaced by their black and white counterparts: + +\begin{minipage}{0.6\linewidth} + \centering + \small + + \input{DataTestRealData} + + \begin{NumericDataPlot}[]{\linewidth}{0.7\linewidth} + \setxAxis{xMin=2, xMax=17, xO=5, Dx=4} + \setyAxis{yMin=20, yMax=70, yO=20, Dy=20} + + \plotxAxis[NoLabel, AxisStyle=Boxed]{} + \plotyAxis[NoLabel, AxisStyle=Boxed]{} + + \listplot[style=BWStdLineStyA]{\DataA} + \listplot[style=BWStdLineStyB]{\DataB} + \listplot[style=BWStdLineStyC]{\DataC} + \listplot[style=BWStdLineStyD]{\DataD} + \listplot[style=BWStdLineStyE]{\DataE} + \listplot[style=BWStdLineStyF]{\DataF} + \listplot[style=BWStdLineStyG]{\DataG} + \end{NumericDataPlot} +\end{minipage} +\begin{minipage}{0.4\linewidth} + \centering + \LegendDefinition{ + \LegLine{style=BWStdLineStyA} & BWStdLineStyA \\ + \LegLine{style=BWStdLineStyB} & BWStdLineStyB \\ + \LegLine{style=BWStdLineStyC} & BWStdLineStyC \\ + \LegLine{style=BWStdLineStyD} & BWStdLineStyD \\ + \LegLine{style=BWStdLineStyE} & BWStdLineStyE \\ + \LegLine{style=BWStdLineStyF} & BWStdLineStyF \\ + \LegLine{style=BWStdLineStyG} & BWStdLineStyG \\ + } +\end{minipage} + +For values which are nearly the same (reference and measurement, e.g.) the +following line styles may be used: + +\begin{minipage}{0.6\linewidth} + \centering + \small + + \input{DataTestRealData} + + \begin{NumericDataPlot}[]{\linewidth}{0.7\linewidth} + \setxAxis{xMin=2, xMax=17, xO=5, Dx=4} + \setyAxis{yMin=20, yMax=70, yO=20, Dy=20} + + \plotxAxis[NoLabel, AxisStyle=Boxed]{} + \plotyAxis[NoLabel, AxisStyle=Boxed]{} + + \listplot[style=StdLineStyX]{\DataC} + \listplot[style=StdLineStyY]{\DataC} + + \listplot[style=BWStdLineStyX]{\DataD} + \listplot[style=BWStdLineStyY]{\DataD} + \end{NumericDataPlot} +\end{minipage} +\begin{minipage}{0.4\linewidth} + \centering + \LegendDefinition{ + \LegLine{style=StdLineStyX} & StdLineStyX \\ + \LegLine{style=StdLineStyY} & StdLineStyY \\ + \LegLine{style=BWStdLineStyX} & BWStdLineStyX \\ + \LegLine{style=BWStdLineStyY} & BWStdLineStyY \\ + } +\end{minipage} + +It is, of course, possible to redefine the available linestyles or to define new +linestyles. + +\begin{minipage}[T]{0.5\linewidth} + \begin{verbatim} + \definecolor{MyColor}{cmyk}{0.6 0.21 1.0 0.2} + \newpsstyle{MyLine} + {linecolor=MyColor, linewidth=2pt, + linestyle=dashed, + dash=1pt 1pt 4pt 1pt 1pt 3pt, + dotstyle=*, showpoints=true, + dotsize=5pt} + \newpsstyle{MyLineA} + {linecolor=blue, linestyle=dotted, + dotstyle=asterisk, showpoints=true} + + \listplot[style=MyLine] + {\IdentI} + \listplot[style=MyLineA] + {\IdentII} + + \putSE{\LegendDefinition{ + \LegLine{style=MyLine} & IdentI + \LegLine{style=MyLineA} & IdentII + }} + \end{verbatim} +\end{minipage} +\begin{minipage}[T]{0.5\linewidth} + \begin{NumericDataPlot} + {\textwidth}{5cm} + + \definecolor{MyColor}{cmyk}{0.6 0.21 1.0 0.2} + \newpsstyle{MyLine}{linecolor=MyColor, linewidth=2pt, linestyle=dashed, + dash=1pt 1pt 4pt 1pt 1pt 3pt, dotstyle=*, showpoints=true, dotsize=5pt} + \newpsstyle{MyLineA}{linecolor=blue, linestyle=dotted, + dotstyle=asterisk, showpoints=true} + + \setxAxis + {xMin=1, xMax=1.6, Dx=0.2} + \setyAxis + {yMin=50, yMax=150, Dy=25} + + \plotxAxis[NoLabel]{} + \plotyAxis[NoLabel]{} + + \listplot[style=MyLine] + {\IdentI} + \listplot[style=MyLineA] + {\IdentII} + + \putSE{\LegendDefinition{ + \LegLine{style=MyLine} & IdentI + }} + \end{NumericDataPlot} +\end{minipage} + + +% ================================= +% | | +% | Legend | +% | | +% ================================= \subsection{Legend} @@ -400,15 +622,23 @@ follwing examples. \LegLine{style=StdLineStyB, linewidth=3pt} & second legend } \begin{verbatim} + \newpsstyle{LegendBoxStyle}% + {framearc=0.2, fillstyle=solid, fillcolor=yellow, opacity=0.2} \LegendDefinition[nrCols=2]{ \LegLine{style=StdLineStyA} & IdentI & \LegLine{style=StdLineStyB, linewidth=3pt} & legend 2 + \newpsstyle{LegendBoxStyle}% + {fillstyle=solid, fillcolor=white} } \end{verbatim} + \newpsstyle{LegendBoxStyle}% + {framearc=0.2, fillstyle=solid, fillcolor=yellow, opacity=0.2} \LegendDefinition[nrCols=2]{ \LegLine{style=StdLineStyA} & IdentI & \LegLine{style=StdLineStyB, linewidth=3pt} & legend 2 } + \newpsstyle{LegendBoxStyle}% + {fillstyle=solid, fillcolor=white} \begin{verbatim} \LegendDefinition[LabelOrientation=c]{ \LegLine{style=StdLineStyA} & IdentI\\ @@ -427,7 +657,7 @@ follwing examples. \subsection{Add Lines to the Plot} Horizontal and vertical lines may be added to the plot with the commands -\verb|\NDPhline{coord}| and \verb|\NDPvline{coord}|. It is also possible to put +\verb|\NDPhline{coord}|, \verb|\NDPvline{coord}| and \verb|\NDPline{coord}|. It is also possible to put nodes and draw lines between them, see placing stuff\ldots \begin{minipage}[T]{0.5\linewidth} @@ -444,7 +674,7 @@ nodes and draw lines between them, see placing stuff\ldots \listplot[style=StdLineStyA] {\IdentI} - + \NDPhline[linecolor=LineColorD]{73} \NDPvline[linecolor=LineColorE, linestyle=dashed]{1.5} \NDPline[linecolor=red]{1.1}{75}{1.3}{125} @@ -465,14 +695,70 @@ nodes and draw lines between them, see placing stuff\ldots \listplot[style=StdLineStyA] {\IdentI} - + \NDPhline[linecolor=LineColorD]{73} \NDPvline[linecolor=LineColorE, linestyle=dashed]{1.5} \NDPline[linecolor=red]{1.1}{75}{1.3}{125} \end{NumericDataPlot} \end{minipage} +\subsection{Add Boxes to the Plot} +Horizontal and vertical boxes may be added to the plot with the commands +\verb|\NDPhbox{coord}|, \verb|\NDPvbox{coord}| and \verb|\NDPbox{coord}|. It is also possible to put +nodes and draw lines between them, see placing stuff\ldots + +\begin{minipage}[T]{0.5\linewidth} + \begin{verbatim} + \begin{NumericDataPlot} + {\textwidth}{5cm} + \setxAxis + {xMin=1, xMax=1.6, Dx=0.2} + \setyAxis + {yMin=50, yMax=150, Dy=25} + + \plotxAxis[NoLabel]{} + \plotyAxis[NoLabel]{} + + \NDPhbox[fillstyle=solid,fillcolor=green]% + {75.0}{100.0}% + + \listplot[style=StdLineStyA] {\IdentI} + + \NDPvbox[fillstyle=solid,fillcolor=red] + {1.4}{1.5} + + \NDPbox[fillstyle=solid,% + fillcolor=orange, opacity=0.2, linestyle=none]% + {1.1}{60}{1.15}{130} + \end{NumericDataPlot} + \end{verbatim} +\end{minipage} +\begin{minipage}[T]{0.5\linewidth} + \vspace{10pt} + \begin{NumericDataPlot} + {\textwidth}{5cm} + \setxAxis + {xMin=1, xMax=1.6, Dx=0.2} + \setyAxis + {yMin=50, yMax=150, Dy=25} + + \plotxAxis[NoLabel]{} + \plotyAxis[NoLabel]{} + + \NDPhbox[fillstyle=solid,fillcolor = green]% + {75.0}{100.0}% + + \listplot[style=StdLineStyA] {\IdentI} + + \NDPvbox[fillstyle=solid,fillcolor=red] + {1.4}{1.5} + + \NDPbox[fillstyle=solid,% + fillcolor=orange, opacity=0.2, linestyle=none]% + {1.1}{60}{1.15}{130} + \end{NumericDataPlot} +\end{minipage} \subsection{Grid} @@ -586,47 +872,3 @@ the axis. To avoid this, plot the grid first and then plot the axis as shown. -\subsection{export2latex.m} - -The function \texttt{export2latex(data, filename, [options])} may be used to -export data from Matlab to be used with NumericPlots.sty. The function takes the two parameters -data and filename, where filename is the name of the file where the data should -be stored with full path but without extension. Data is a structure with the -three entries x, y, and ident, where x are the x-data, y the y-data and ident is -an identifier to have access to the data in Latex. To access the data in Latex -the command \verb+\Data<ident>+ is used. - -The parameter data may be provided as an 1xK array if each entry of the array is -a structure with the entries x, y and ident. There may be an additional entry -descr. -\begin{itemize} - \item data(1,i).x = $X_i$ - \item data(1,i).y = $Y_i$ - \item data(1,i).ident = Identifier - \item (data(1,i).descr = Description) -\end{itemize} -Identifier must be a valid Latex command name, which basically means it must be -a string without numbers. - -For every entry of data, $X$ and $Y$ must be arrays of the same size -$M\text{x}N$. If $M>1$, each column of the array is exported to the file and the -identifier is expanded by the roman representation of the column number. - -It might be useful to do a \texttt{interp1} before exporting the data to get -smaller files and to use less of \TeX's memory. ($\rightarrow$ script -Patrick?!?) - -The optional parameter \texttt{options} might be used to control which -additional information is provided in the output file. -\begin{itemize} - \item \texttt{options.DataBoundaries} [true] If set to true, the output file - contains the commands \verb+\DataXmin+, \verb+\DataXmax+, \verb+\DataYmin+ and - \verb+\DataYmax+ which may be used to define the axis. - \item \texttt{options.AxisBoundaries} [false] If set to true, the output file - contains the commands \verb+\DataXminAxis+, \verb+\DataXmaxAxis+, - \verb+\DataYminAxis+ and \verb+\DataYmaxAxis+ which may be used to define the - axis. In contrary to the DataBoundaries the AxisBoundaries add an additional - gap of \texttt{options.AxisBoundariesGap} [10] percent of the full scale to - the data boundaries such that the plot doesn't touch the axis. -\end{itemize} - |