From 5cc69ea6e2773435574a4d4f3cc67ef8833fd62b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 1 Jun 2012 22:12:53 +0000 Subject: numericplots (1jun12) git-svn-id: svn://tug.org/texlive/trunk@26791 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/numericplots/MatlabSupport.tex | 64 ++++++++++-- .../doc/latex/numericplots/MultiplePlots.tex | 52 ++++++++++ .../doc/latex/numericplots/NumericPlots.pdf | Bin 153190 -> 154313 bytes .../doc/latex/numericplots/README.TEXLIVE | 4 + .../texmf-dist/doc/latex/numericplots/history.tex | 8 ++ .../tex/latex/numericplots/NumericPlots.sty | 107 ++++++++++++++------- 6 files changed, 189 insertions(+), 46 deletions(-) diff --git a/Master/texmf-dist/doc/latex/numericplots/MatlabSupport.tex b/Master/texmf-dist/doc/latex/numericplots/MatlabSupport.tex index 32802955b88..6c914996ca4 100644 --- a/Master/texmf-dist/doc/latex/numericplots/MatlabSupport.tex +++ b/Master/texmf-dist/doc/latex/numericplots/MatlabSupport.tex @@ -1,12 +1,12 @@ \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+ is used. +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+ 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 @@ -43,7 +43,24 @@ additional information is provided in the output file. \end{itemize} \subsection{struct2latex.m} -The function \texttt{struct2latex(data,[xname],[downsample],[filename],[postfix],[options])} may be used to export a Matlab struct to be used with NumericPlots.sty. The function is based on export2latex and the \verb+options+ argument is given to export2latex. The optional argument \verb+xname+ specifies the fieldname of the x-data. If no \verb+xname+ is given, you have to chose one via popup. All other fields are treated like y-data. Furthermore, the identifier of the y-data are equal to the fieldnames and have to be valid Latex commands (fieldnames with numbers are not supported). The struct2latex command only supports 1 dimensional arrays (row vectors). Column vectors are mapped for propper export without warning. With the optional argument \verb+downsample+ (integer>0) it is possible to downsample the data for smaller files. A warning is given when data points exceed $5000$. Usually $1000$ data points are enough for a propper plot in latex. The optional argument \verb+filename+ specifies the outputname with path of the texfile. If no filename is given, it has to be chosen via popup. The optional argument \verb+postfix+ can be used to put a postfix after the fieldname in the identifier of the y-data. The \verb+options+ argument is also optional and equal to the options argument of the function export2latex. +The function +\texttt{struct2latex(data,[xname],[downsample],[filename],[postfix],[options])} +may be used to export a Matlab struct to be used with NumericPlots.sty. The +function is based on export2latex and the \verb+options+ argument is given to +export2latex. The optional argument \verb+xname+ specifies the fieldname of the +x-data. If no \verb+xname+ is given, you have to chose one via popup. All other +fields are treated like y-data. Furthermore, the identifier of the y-data are +equal to the fieldnames and have to be valid Latex commands (fieldnames with +numbers are not supported). The struct2latex command only supports 1 dimensional +arrays (row vectors). Column vectors are mapped for propper export without +warning. With the optional argument \verb+downsample+ (integer$>0$) it is +possible to downsample the data for smaller files. A warning is given when data +points exceed $5000$. Usually $1000$ data points are enough for a propper plot +in latex. The optional argument \verb+filename+ specifies the outputname with +path of the texfile. If no filename is given, it has to be chosen via popup. The +optional argument \verb+postfix+ can be used to put a postfix after the +fieldname in the identifier of the y-data. The \verb+options+ argument is also +optional and equal to the options argument of the function export2latex. Matlab example. \begin{verbatim} @@ -65,13 +82,40 @@ Matlab example. \end{verbatim} \subsection{dspace2struct} -The function \texttt{dspace2struct(dataname,version)} may be used to import \texttt{.mat} created by \textsc{dSpace} to \textsc{Matlab}. It returns a \textsc{Matlab} struct out of the provided variables \verb+dataname+ and \verb+version+. Thereby \verb+dataname+ is the name of the \textsc{dSpace} \verb+.mat+ file and the optional string argument \verb+version+ has to be equal \verb+version = 'NG'+ if \textsc{dSpace Control Desk Next Generation} is used. It is convenient to chose a unique signal name in \textsc{Matlab/Simulink} because they will be the same in \textsc{dSpace}. The function \texttt{dspace2struct(dataname,version)} just adopts the names provided by \textsc{dSpace} and use them as fieldnames. The time vector will always be called \verb+.time+. +The function \texttt{dspace2struct(dataname,version)} may be used to import +\texttt{.mat} created by \textsc{dSpace} to \textsc{Matlab}. It returns a +\textsc{Matlab} struct out of the provided variables \verb+dataname+ and +\verb+version+. Thereby \verb+dataname+ is the name of the \textsc{dSpace} +\verb+.mat+ file and the optional string argument \verb+version+ has to be equal +\verb+version = 'NG'+ if \textsc{dSpace Control Desk Next Generation} is used. +It is convenient to chose a unique signal name in \textsc{Matlab/Simulink} +because they will be the same in \textsc{dSpace}. The function +\texttt{dspace2struct(dataname,version)} just adopts the names provided by +\textsc{dSpace} and use them as fieldnames. The time vector will always be +called \verb+.time+. -Matlab example. +Matlab example: \begin{verbatim} dataOG = dspace2struct(measurements) %Old Control Desk dataNG = dspace2struct(measurements,'NG') %Control Desk Next Generation \end{verbatim} +The resulting structs \verb+dataOG+ and \verb+dataNG+ differ in way of +structuring. In the older versions of \textsc{dSpace} it was only possible to +save one time vector. The \textsc{dSpace Control Desk Next Generation} allows to +save several time vectors. So it was necessary to save the index of the time +vector with the signal name. Typical plot commands for the two data structures +look as follows: +\begin{verbatim} + %Old Control Desk + plot(dataOG.time,dataOG.signalname); + + %Control Desk Next Generation + plot(dataNG.time(dataNG.signalname.timeidx),dataNG.signalname.Data); +\end{verbatim} \subsection{dspace2latex} -The function \texttt{dspace2latex} is just a combination of \texttt{dspace2struct} and \texttt{struct2latex} with commonly used arguments. It is a simple and quick way to export measurements from \textsc{dSpace} to \LaTeX{} without any revision of the data. \ No newline at end of file +The function \texttt{dspace2latex} is just a combination of +\texttt{dspace2struct} and \texttt{struct2latex} with commonly used arguments. +It is a simple and quick way to export measurements from \textsc{dSpace} to +\LaTeX{} without any revision of the data. However, the current implementation +allows only data structures of the old version of \textsc{dSpace Control Desk}. diff --git a/Master/texmf-dist/doc/latex/numericplots/MultiplePlots.tex b/Master/texmf-dist/doc/latex/numericplots/MultiplePlots.tex index b2490bcf445..c385635b9c9 100644 --- a/Master/texmf-dist/doc/latex/numericplots/MultiplePlots.tex +++ b/Master/texmf-dist/doc/latex/numericplots/MultiplePlots.tex @@ -177,4 +177,56 @@ showpoints=true, dotsize=10pt} \LegendDefinition[nrCols=1, LabelOrientation=r]{ \LegLine{style=Database} & Werte aus der Datenbank \\ \LegLine{style=Result} & Modell} +\end{center} + +An example with different y-axes on the left and on the right side: +\begin{small} +\begin{verbatim} +\begin{center} + \begin{NumericDataPlot}{\textwidth}{0.25\textheight} + + % --- definition of the axis and the grid --- + \setxAxis{xMin=2, xMax=17, Dx=4} + \setyAxis{yMin=20, yMax=70, Dy=20} + + % plot the axis of the lower left corner + \plotxAxis{Stichnummer} + \plotyAxis{$F_{roll}$ in $\mega\newton$} + + \listplot[style=Database]{\DataA} + + % define a second y-axis + \setyAxis{yMin=40, yMax=90, Dy=20} + \plotyAxis[AxisStyle=Right, NoGrid]{$F_{roll}$} + + \listplot[style=Result]{\DataA} + + \end{NumericDataPlot} +\end{center} +\end{verbatim} +\end{small} + +\begin{center} + \begin{NumericDataPlot}{\textwidth}{0.25\textheight} + + % --- definition of the axis and the grid --- + \setxAxis{xMin=2, xMax=17, Dx=4} + \setyAxis{yMin=20, yMax=70, Dy=20} + + % plot the axis of the lower left corner + \plotxAxis{Stichnummer} + \plotyAxis{$F_{roll}$ in $\mega\newton$} + + \listplot[style=Database]{\DataA} + + % define a second y-axis + \setyAxis{yMin=40, yMax=90, Dy=20} + \plotyAxis[AxisStyle=Right, NoGrid]{$F_{roll}$} + + \listplot[style=Result]{\DataA} + + + + \end{NumericDataPlot} + \end{center} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/numericplots/NumericPlots.pdf b/Master/texmf-dist/doc/latex/numericplots/NumericPlots.pdf index 35f89558c41..1559820da0b 100644 Binary files a/Master/texmf-dist/doc/latex/numericplots/NumericPlots.pdf and b/Master/texmf-dist/doc/latex/numericplots/NumericPlots.pdf differ diff --git a/Master/texmf-dist/doc/latex/numericplots/README.TEXLIVE b/Master/texmf-dist/doc/latex/numericplots/README.TEXLIVE index 9ea78720ba6..4397c9c38a5 100644 --- a/Master/texmf-dist/doc/latex/numericplots/README.TEXLIVE +++ b/Master/texmf-dist/doc/latex/numericplots/README.TEXLIVE @@ -4,8 +4,12 @@ missing source code. You can find these files on CTAN at http://mirror.ctan.org/graphics/pstricks/contrib/numericplots If questions or concerns, email tex-live@tug.org. + LatexFilter.m struct2latex.m roman.m + struct2pst.m dspace2struct.m export2latex.m + struct2latexcampaign.m dspace2latex.m + export2pst.m diff --git a/Master/texmf-dist/doc/latex/numericplots/history.tex b/Master/texmf-dist/doc/latex/numericplots/history.tex index f3c46405822..de71d1919bf 100644 --- a/Master/texmf-dist/doc/latex/numericplots/history.tex +++ b/Master/texmf-dist/doc/latex/numericplots/history.tex @@ -95,5 +95,13 @@ \item changes in documentation \item adopted \texttt{dspace2struct} for \textsc{dSpace Next Generation} \item added \verb+\NDPvline, \NDPhline, \NDPvbox+ and \verb+\NDPhbox+ + \end{itemize} + \item 01.06.2012 + \begin{itemize} + \item changes in documentation + \item general bug fixing + \item bug fixing for \texttt{dspace2struct} + \item suppressing notification of the calculations made by the fp package + during the compilation. \end{itemize} \end{itemize} \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/numericplots/NumericPlots.sty b/Master/texmf-dist/tex/latex/numericplots/NumericPlots.sty index 7eb6722b7df..8c50ac87cf9 100644 --- a/Master/texmf-dist/tex/latex/numericplots/NumericPlots.sty +++ b/Master/texmf-dist/tex/latex/numericplots/NumericPlots.sty @@ -30,7 +30,7 @@ \RequirePackage{calc} -\RequirePackage{fp} +\RequirePackage[nomessages]{fp} \RequirePackage{ifthen} \RequirePackage{pstricks} @@ -248,26 +248,26 @@ % | keys for the legend % ---------------------------------------------------------------------------- -\define@key[NumericDataPlot]{Legend}{nrCols}[1]{\renewcommand{\nrLegendCols}{#1}} -\define@key[NumericDataPlot]{Legend}{LegLineWidth}[20pt]{\setlength{\LegLineWidth}{#1}} +\define@key[NumericDataPlot]{Legend}{nrCols}[1]{\renewcommand{\nrLegendCols}{#1}}% +\define@key[NumericDataPlot]{Legend}{LegLineWidth}[20pt]{\setlength{\LegLineWidth}{#1}}% \define@choicekey+[NumericDataPlot]{Legend}{LabelOrientation}[\val\nrLegOrient] -{r,l,c}{ - \ifcase\nrLegOrient\relax - \setboolean{LegendOrientationLeft}{false} - \setboolean{LegendOrientationRight}{true} - \setboolean{LegendOrientationCenter}{false} - \or - \setboolean{LegendOrientationLeft}{true} - \setboolean{LegendOrientationRight}{false} - \setboolean{LegendOrientationCenter}{false} - \or - \setboolean{LegendOrientationLeft}{false} - \setboolean{LegendOrientationRight}{false} - \setboolean{LegendOrientationCenter}{true} - \fi +{r,l,c}{% + \ifcase\nrLegOrient\relax% + \setboolean{LegendOrientationLeft}{false}% + \setboolean{LegendOrientationRight}{true}% + \setboolean{LegendOrientationCenter}{false}% + \or% + \setboolean{LegendOrientationLeft}{true}% + \setboolean{LegendOrientationRight}{false}% + \setboolean{LegendOrientationCenter}{false}% + \or% + \setboolean{LegendOrientationLeft}{false}% + \setboolean{LegendOrientationRight}{false}% + \setboolean{LegendOrientationCenter}{true}% + \fi% }{ - \PackageWarning{NumericPlots}{LabelOrientation #1 not defined. Use r, l or c} + \PackageWarning{NumericPlots}{LabelOrientation #1 not defined. Use r, l or c}% } @@ -321,12 +321,44 @@ \psline[style=#2](lab#2)(lab#2)% } +% \newcommand{\LegLine}[2][]{% +% \setkeys[NumericDataPlot]{Legend}{#1} +% % +% \centering\Rnode{LegLineNode}{}% +% \psline[#2,showpoints=false]([nodesep=0.5\LegLineWidth]LegLineNode)([nodesep=-0.5\LegLineWidth]LegLineNode)% +% \psline[#2, linestyle=none](LegLineNode)(LegLineNode) +% } +% +% +% \newcommand{\LegendDefinition}[2][nrCols]{% +% \setkeys[NumericDataPlot]{Legend}{#1}% +% % +% \psframebox[style=LegendBoxStyle]{% +% \ifLegendOrientationLeft +% \begin{tabular}{*{\nrLegendCols}{p{\LegLineWidth}l}}% +% #2% +% \end{tabular}% +% \fi +% \ifLegendOrientationCenter +% \begin{tabular}{*{\nrLegendCols}{p{\LegLineWidth}c}} +% #2 +% \end{tabular} +% \fi +% \ifLegendOrientationRight +% \begin{tabular}{*{\nrLegendCols}{p{\LegLineWidth}r}} +% #2 +% \end{tabular} +% \fi +% }%psframebox +% } + \newcommand{\LegLine}[2][]{% - \setkeys[NumericDataPlot]{Legend}{#1} - % + \setkeys[NumericDataPlot]{Legend}{#1}% + \parbox[t]{\LegLineWidth}{% \centering\Rnode{LegLineNode}{}% - \psline[#2,showpoints=false]([nodesep=0.5\LegLineWidth]LegLineNode)([nodesep=-0.5\LegLineWidth]LegLineNode)% - \psline[#2](LegLineNode)(LegLineNode)% + \psline[#2,showpoints=false]([nodesep=0.5\LegLineWidth]LegLineNode)([nodesep=-0.5\LegLineWidth]LegLineNode)% + \psline[#2, linestyle=none](LegLineNode)(LegLineNode)% + } } @@ -334,18 +366,18 @@ \setkeys[NumericDataPlot]{Legend}{#1}% % \psframebox[style=LegendBoxStyle]{% - \ifLegendOrientationLeft - \begin{tabular}{*{\nrLegendCols}{p{\LegLineWidth}l}}% + \ifLegendOrientationLeft% + \begin{tabular}{*{\nrLegendCols}{ll}}% #2% \end{tabular}% \fi \ifLegendOrientationCenter - \begin{tabular}{*{\nrLegendCols}{p{\LegLineWidth}c}} + \begin{tabular}{*{\nrLegendCols}{cc}} #2 \end{tabular} \fi \ifLegendOrientationRight - \begin{tabular}{*{\nrLegendCols}{p{\LegLineWidth}r}} + \begin{tabular}{*{\nrLegendCols}{cr}} #2 \end{tabular} \fi @@ -528,6 +560,8 @@ \fi } +% for logarithmic axes, LogxAxisLabel returns 10^#1. Normally it just returns +% #1. \newcommand{\plotxTickLabels}[3]{ \FPadd{\NumDataPlotBuffer}{\TicksXLeft}{1} \FPround{\NumDataPlotBuffer}{\NumDataPlotBuffer}{0} @@ -1104,15 +1138,16 @@ \DeclareOptionX{BW}{ - \newpsstyle{StdLineStyA}{BWStdLineStyA} - \newpsstyle{StdLineStyB}{BWStdLineStyb} - \newpsstyle{StdLineStyC}{BWStdLineStyC} - \newpsstyle{StdLineStyD}{BWStdLineStyD} - \newpsstyle{StdLineStyE}{BWStdLineStyE} - \newpsstyle{StdLineStyF}{BWStdLineStyF} - \newpsstyle{StdLineStyG}{BWStdLineStyG} + \addtopsstyle{StdLineStyA}{style=BWStdLineStyA} + \addtopsstyle{StdLineStyB}{style=BWStdLineStyB} + \addtopsstyle{StdLineStyC}{style=BWStdLineStyC} + \addtopsstyle{StdLineStyD}{style=BWStdLineStyD} + \addtopsstyle{StdLineStyE}{style=BWStdLineStyE} + \addtopsstyle{StdLineStyF}{style=BWStdLineStyF} + \addtopsstyle{StdLineStyG}{style=BWStdLineStyG} } + \DeclareOptionX{beamer}{ \renewcommand{\StdLLY}{-1.0cm} \renewcommand{\StdTickLabelOption}{\footnotesize} @@ -1165,7 +1200,7 @@ \presetkeys[NumericDataPlot]{General}{ xPicMin=0, yPicMin=0, xPicMax=1000, yPicMax=1000, TickLength=2}{} -\presetkeys[NumericDataPlot]{Legend}{ - LabelOrientation=l -}{} +\presetkeys[NumericDataPlot]{Legend}{% + LabelOrientation=l% +}{}% -- cgit v1.2.3