diff options
author | Karl Berry <karl@freefriends.org> | 2011-02-05 00:16:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-02-05 00:16:56 +0000 |
commit | 3452f352c7df351df8f08f0ae01f6cae4ace2fb4 (patch) | |
tree | 2e6618d90444854d4fdc9f0f6273546566d884b5 | |
parent | acc047ba3ea08abac25940c1cec10cced0297c4b (diff) |
pstricks-add (2feb11)
git-svn-id: svn://tug.org/texlive/trunk@21290 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/generic/pstricks-add/Changes | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf | bin | 1780776 -> 1806906 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex | 202 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex | 85 |
4 files changed, 277 insertions, 14 deletions
diff --git a/Master/texmf-dist/doc/generic/pstricks-add/Changes b/Master/texmf-dist/doc/generic/pstricks-add/Changes index e9a470d06ba..6ce4488dd56 100644 --- a/Master/texmf-dist/doc/generic/pstricks-add/Changes +++ b/Master/texmf-dist/doc/generic/pstricks-add/Changes @@ -1,4 +1,4 @@ -%% $Id: Changes 445 2011-01-18 18:43:16Z herbert $ +%% $Id: Changes 453 2011-01-29 13:44:41Z herbert $ %% pstricks-add.pro ----------- 0.23 2009-12-20 - add RGBtoGRAY and WavelengthToGRAY @@ -39,6 +39,8 @@ pstricks-add.sty ----------- (hv) pstricks-add.tex ----------- (Dominik Rodriguez/hv) + v 3.51 2011-02-02 - add new Macro\psKiviat for Kiviat diagrams + v 3.50 2011-01-29 - add new optional argument colorTypeDef for \psMatrix v 3.49 2011-01-18 - add macro \psEllipseTangents for drawing tangent lines of a point and an ellipse. v 3.48 2010-12-18 - add macro \psCircleTangents for drawing tangent diff --git a/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf b/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf Binary files differindex ba27a113b54..f1d8ec59ba0 100644 --- a/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf +++ b/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf diff --git a/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex b/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex index 88c43ec9e10..4f0ede49b5b 100644 --- a/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex +++ b/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex @@ -1,4 +1,4 @@ -%% $Id: pstricks-add-doc.tex 445 2011-01-18 18:43:16Z herbert $ +%% $Id: pstricks-add-doc.tex 454 2011-01-29 15:42:34Z herbert $ \documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings headexclude,footexclude,oneside]{pst-doc} \listfiles @@ -3362,7 +3362,7 @@ as starting values for another equation. %-------------------------------------------------------------------------------------- \clearpage -\section{\nxLcs{psMatrixPlot}} +\section{\nxLcs{psMatrixPlot}}\label{sec:psMatrix} %-------------------------------------------------------------------------------------- \begin{filecontents}{matrix.data} /dotmatrix [ % @@ -3421,7 +3421,7 @@ is the first plotted line ($y=1$). With the option \end{pspicture}}\quad \psscalebox{0.6}{% \begin{pspicture}(-0.5,-0.75)(11,11) - \psaxes{->}(11,11) + \psaxes[ticksize=-5pt 0]{->}(11,11) \psMatrixPlot[dotsize=1.1cm,dotstyle=square*,linecolor=magenta,XYoffset=-0.5]% {10}{10}{matrix.data} \psMatrixPlot[dotsize=.5cm,dotstyle=o,ChangeOrder,XYoffset=-0.5]{10}{10}{matrix.data} @@ -3431,7 +3431,7 @@ is the first plotted line ($y=1$). With the option \begin{lstlisting} \psscalebox{0.6}{% \begin{pspicture}(-0.5,-0.75)(11,11) - \psaxes{->}(11,11) + \psaxes[ticksize=-5pt 0]{->}(11,11) \psMatrixPlot[dotsize=1.1cm,dotstyle=square*,linecolor=magenta]% {10}{10}{matrix.data} \psMatrixPlot[dotsize=.5cm,dotstyle=o,ChangeOrder]{10}{10}{matrix.data} @@ -3447,7 +3447,7 @@ is the first plotted line ($y=1$). With the option \begin{LTXexample}[pos=t,preset=\centering] \begin{pspicture}(-0.5,-0.75)(11,11) - \psaxes{->}(11,11) + \psaxes[ticksize=-5pt 0]{->}(11,11) \psMatrixPlot[dotscale=3,dotstyle=*,linecolor=blue]{10}{8}{matrix.data} \end{pspicture} \end{LTXexample} @@ -3490,6 +3490,187 @@ matrix data, which is saved as /dotmatrix [...] in the file \LFile{pstricks-add- \egroup \clearpage +With the \Lkeyword{colorType}=5 the color setting can be user defined by the +optional argument \Lkeyword{colorTypeDef}. On the stack is the current value +which can be used for the setting but must be left on the stack when everything +is finished. The following example prints the 0 as color white, the value 1 as +black and all other values depending to the corresponding gray value. + +\begin{filecontents*}{matrix1.data} +/dotmatrix [ % <------------ important line +3 0 0 0 0 0 0 0 1 2 +0 0 0 0 0 0 0 1 2 1 +8 0 0 0 0 0 1 2 1 0 +0 0 0 0 0 1 2 1 0 0 +0 0 0 0 1 2 1 0 0 0 +9 0 0 1 2 1 3 0 0 0 +0 0 1 2 1 4 0 0 0 0 +0 1 2 1 5 0 0 0 0 0 +1 2 1 6 0 0 0 0 0 0 +2 1 7 0 0 0 0 0 0 3 +] def % <------------ important line +\end{filecontents*} + +\begin{center} +\psscalebox{0.7}{% +\begin{pspicture}(-0.5,-0.75)(11,11) +\psaxes[ticksize=-5pt 0]{->}(11,11) +\psMatrixPlot[ + colorType=5, + colorTypeDef={ + dup /value exch def % save value and leave one on the stack + value Min sub dMaxMin div neg 1 add 300 mul 400 add \pswavelengthToGRAY + value 0 eq \pslbrace 1 \psrbrace if % + value 1 eq \pslbrace 0 \psrbrace if + setgray + }, + dotsize=1.1cm,xStep=1,yStep=1,dotstyle=square*]{10}{10}{matrix1.data} +\end{pspicture}} +\end{center} + + +\begin{lstlisting} +\begin{filecontents}{matrix1.data} +/dotmatrix [ % <------------ important line +3 0 0 0 0 0 0 0 1 2 +0 0 0 0 0 0 0 1 2 1 +8 0 0 0 0 0 1 2 1 0 +0 0 0 0 0 1 2 1 0 0 +0 0 0 0 1 2 1 0 0 0 +9 0 0 1 2 1 3 0 0 0 +0 0 1 2 1 4 0 0 0 0 +0 1 2 1 5 0 0 0 0 0 +1 2 1 6 0 0 0 0 0 0 +2 1 7 0 0 0 0 0 0 3 +] def % <------------ important line +\end{filecontents} +\psscalebox{0.7}{% +\begin{pspicture}(-0.5,-0.75)(11,11) +\psaxes[ticksize=-5pt 0]{->}(11,11) +\psMatrixPlot[ + colorType=5, + colorTypeDef={ + dup /value exch def % save value and leave one on the stack + value Min sub dMaxMin div neg 1 add 300 mul 400 add \pswavelengthToGRAY + value 0 eq \pslbrace 1 \psrbrace if % + value 1 eq \pslbrace 0 \psrbrace if + setgray + }, + dotsize=1.1cm,xStep=1,yStep=1,dotstyle=square*]{10}{10}{matrix1.data} +\end{pspicture}} +\end{lstlisting} + + +\Lps{if} statements in the color definition must be enclosed with \Lcs{pslbrace} and \Lcs{psrbrace} +when they are parentheses used in PostScript. In the above example the color definition should be +modified when the matrix is a real big one, in such a case a nested \Lps{ifelse} makes more sense: + +\begin{lstlisting} + colorTypeDef={ + dup /value exch def + value 0 eq + \pslbrace 1 setgray \psrbrace + \pslbrace value 1 eq + \pslbrace 0 setgray \psrbrace + \pslbrace Min sub dMaxMin div neg 1 add 300 mul 400 add + \pswavelengthToGRAY setgray \psrbrace ifelse + \psrbrace ifelse + }, +\end{lstlisting} + +Replace the \Lcs{pslbrace} and \Lcs{psrbrace} with \{ and \} if it maybe confusing to read: + +\begin{lstlisting} + dup /value exch def + value 0 eq + { 1 setgray } + { value 1 eq + { 0 setgray } + { Min sub dMaxMin div neg 1 add 300 mul 400 add + \pswavelengthToGRAY setgray } ifelse + } ifelse +\end{lstlisting} + +Another possibility is to define the color procedure onside the data file, where +it \emph{must} be named \Lps{colorTypeDef}. If such a definition exists, the one from +the optional argument \Lkeyword{colorTypeDef} will be ignored. There can be no +\TeX-specific code inside this definition because it is read on PostScript level, +the reason why \Lcs{pswavelengthToGRAY} cannot be used. + +\begin{center} +\begin{filecontents}{matrix1.data} +/colorTypeDef { + dup /value exch def + value 0 eq + { 1 setgray } + { value 1 eq + { 0 setgray } + { Min sub dMaxMin div neg 1 add 300 mul 400 add +% \pswavelengthToGRAY not possible + tx@addDict begin wavelengthToRGB Red Green Blue end + setrgbcolor + } ifelse + } ifelse +} def +/dotmatrix [ % <------------ important line +3 0 0 0 0 0 0 0 1 2 +0 0 0 0 0 0 0 1 2 1 +8 0 0 0 0 0 1 2 1 0 +0 0 0 0 0 1 2 1 0 0 +0 0 0 0 1 2 1 0 0 0 +9 0 0 1 2 1 3 0 0 0 +0 0 1 2 1 4 0 0 0 0 +0 1 2 1 5 0 0 0 0 0 +1 2 1 6 0 0 0 0 0 0 +2 1 7 0 0 0 0 0 0 3 +] def % <------------ important line +\end{filecontents} +\psscalebox{0.7}{% +\begin{pspicture}(-0.5,-0.75)(11,11) +\psaxes[ticksize=-5pt 0]{->}(11,11) +\psMatrixPlot[ + colorType=5,dotsize=1.1cm,xStep=1,yStep=1,dotstyle=square*]{10}{10}{matrix1.data} +\end{pspicture}} +\end{center} + +\begin{lstlisting} +\begin{filecontents}{matrix1.data} +/colorTypeDef { + dup /value exch def + value 0 eq + { 1 setgray } + { value 1 eq + { 0 setgray } + { Min sub dMaxMin div neg 1 add 300 mul 400 add +% \pswavelengthToRGB not possible + tx@addDict begin wavelengthToRGB Red Green Blue end + setrgbcolor + } ifelse + } ifelse +} def +/dotmatrix [ % <------------ important line +3 0 0 0 0 0 0 0 1 2 +0 0 0 0 0 0 0 1 2 1 +8 0 0 0 0 0 1 2 1 0 +0 0 0 0 0 1 2 1 0 0 +0 0 0 0 1 2 1 0 0 0 +9 0 0 1 2 1 3 0 0 0 +0 0 1 2 1 4 0 0 0 0 +0 1 2 1 5 0 0 0 0 0 +1 2 1 6 0 0 0 0 0 0 +2 1 7 0 0 0 0 0 0 3 +] def % <------------ important line +\end{filecontents} +\psscalebox{0.7}{% +\begin{pspicture}(-0.5,-0.75)(11,11) +\psaxes[ticksize=-5pt 0]{->}(11,11) +\psMatrixPlot[colorType=5,dotsize=1.1cm,xStep=1,yStep=1, + dotstyle=square*]{10}{10}{matrix1.data} +\end{pspicture}} +\end{lstlisting} + + + %-------------------------------------------------------------------------------------- \section{Dashed Lines} %-------------------------------------------------------------------------------------- @@ -4852,7 +5033,18 @@ be seen with Acroread 7 or later. The syntax is easy: \end{pspicture} \end{LTXexample} +\section{Internal color macros} +The internal macros \Lcs{pswavelengthToRGB} and \Lcs{pswavelengthToRGB} can be used for own purposed. +They are defines as follows: + +\begin{lstlisting} +\def\pswavelengthToGRAY{ tx@addDict begin wavelengthToGRAY end } +\def\pswavelengthToRGB{ tx@addDict begin wavelengthToRGB Red Green Blue end } +\end{lstlisting} +both macros leave the value(s) on the stack which then can be used for further +manipulating or setting the color with \Lps{setgray} or \Lps{setrgbcolor}. +For an example see Section~\ref{sec:psMatrix}. \appendix diff --git a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex index 3d7da83946c..0361b9c16d8 100644 --- a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex +++ b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex @@ -1,4 +1,4 @@ -%% $Id: pstricks-add.tex 445 2011-01-18 18:43:16Z herbert $ +%% $Id: pstricks-add.tex 459 2011-02-02 18:32:36Z herbert $ %% %% %% This is file `pstricks-add.tex', @@ -31,8 +31,8 @@ \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi \ifx\PSTmathLoaded\endinput\else \input pst-math \fi % -\def\fileversion{3.49} -\def\filedate{2011/01/18} +\def\fileversion{3.51} +\def\filedate{2011/02/02} \message{`pstricks-add' v\fileversion, \filedate\space (dr,hv)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax @@ -1633,17 +1633,22 @@ dup #1Delta.X m 1 add get mul #1.X m get add #1Tick.X j 3 -1 roll put % s on sta % ..... % ] def % +\def\pswavelengthToGRAY{ tx@addDict begin wavelengthToGRAY end } +\def\pswavelengthToRGB{ tx@addDict begin wavelengthToRGB Red Green Blue end } +% \define@key[psset]{pstricks-add}{Xoffset}[0pt]{\pst@getlength{#1}\psk@Xoffset} \define@key[psset]{pstricks-add}{Yoffset}[0pt]{\pst@getlength{#1}\psk@Yoffset} \define@key[psset]{pstricks-add}{XYoffset}[0pt]{\pst@getlength{#1}\psk@Xoffset\let\psk@Yoffset\psk@Xoffset} \psset[pstricks-add]{XYoffset=0pt} \define@key[psset]{pstricks-add}{colorType}[0]{\def\psk@colorType{#1}} -\psset[pstricks-add]{colorType=0} % 0-> two color mode 1->wavelength mode (400..700nm) +\define@key[psset]{pstricks-add}{colorTypeDef}[{}]{\def\psk@colorTypeDef{#1\space}} +\psset[pstricks-add]{colorType=0,colorTypeDef={}} % 0-> two color mode 1->wavelength mode (400..700nm) % 0-> two color mode % 1-> wavelength mode (400..700nm) % 2-> wavelength mode inverse % 3-> gray color mode % 4-> gray color mode invers +% 5-> own color definition \def\psMatrixPlot{\def\pst@par{}\pst@object{psMatrixPlot}} \def\psMatrixPlot@i#1#2#3{% \pst@killglue% @@ -1667,16 +1672,18 @@ dup #1Delta.X m 1 add get mul #1.X m get add #1Tick.X j 3 -1 roll put % s on sta dup 0 gt { % test if > 0 \or Min sub dMaxMin div 300 mul 400 add - tx@addDict begin wavelengthToRGB Red Green Blue end setrgbcolor + \pswavelengthToRGB setrgbcolor \or Min sub dMaxMin div neg 1 add 300 mul 400 add - tx@addDict begin wavelengthToRGB Red Green Blue end setrgbcolor + \pswavelengthToRGB setrgbcolor \or Min sub dMaxMin div neg 1 add 300 mul 400 add - tx@addDict begin wavelengthToGRAY end setgray + \pswavelengthToGRAY setgray \or Min sub dMaxMin div neg 1 add 300 mul 400 add - tx@addDict begin wavelengthToGRAY end neg 1 add setgray + \pswavelengthToGRAY neg 1 add setgray + \or + currentdict /colorTypeDef known { colorTypeDef } { \psk@colorTypeDef } ifelse \fi x \psk@xStep\space mul \pst@number\psxunit mul \ifPst@ChangeOrder #1 y sub 1 add \else y \fi \psk@yStep\space mul \pst@number\psyunit mul Dot% @@ -2252,6 +2259,68 @@ dup #1Delta.X m 1 add get mul #1.X m get add #1Tick.X j 3 -1 roll put % s on sta Xt #1 add Yt #2 add ) {EllipseT2}% \ignorespaces}% % +\define@key[psset]{pstricks-add}{rotate}{\def\psk@rotate{#1 }} +\psset[pstricks-add]{rotate=0} + +\def\pst@saveDegrees{} + +\def\psKiviat{\pst@object{psKiviat}} +\def\psKiviat@i#1#2{% #1: number of edges #2 radius + \gdef\pst@saveDegrees{#1} + \begingroup% + \degrees[#1]% + \SpecialCoor% + \addbefore@par{rotate=0} + \use@par% + \global\let\psk@@rotate\psk@rotate + \def\pst@Coordinates{} + \psLoop{#1}{\xdef\pst@Coordinates{\pst@Coordinates(#2;\the\psLoopIndex)}} + \rput{\psk@rotate}(0,0){\expandafter\pspolygon\pst@Coordinates + \multido{\nA=0+1}{#1}{\uput{\pslabelsep}[\nA]{*0}(#2;\nA){\psPutYLabel{\nA}}}} + \endgroup% + \ignorespaces} +% +\def\psKiviatLine{\pst@object{psKiviatLine}} +\def\psKiviatLine@i#1{{% + \addbefore@par{showpoints}% + \use@par% + \degrees[\pst@saveDegrees]% + \psKiviatLine@ii#1\@nil}}% +\def\psKiviatLine@ii#1,#2\@nil{% + \global\pst@cntm=0 + \global\pst@cntn=1 + \begingroup + \xdef\pst@saveCoors{} + \psKiviatLine@iii#1,#2,#1,,\@nil + \rput{\psk@@rotate}(0,0){\expandafter\pspolygon\pst@saveCoors} +} +\def\psKiviatLine@iii#1,#2,#3\@nil{% + \ifx\relax#2\relax\else%\psline(#1;\the\pst@cntm)(#2;\the\pst@cntn) + \xdef\pst@saveCoors{\pst@saveCoors(#1;\the\pst@cntm)}\fi + \advance\pst@cntm\@ne + \advance\pst@cntn\@ne + \ifx\relax#3\relax\endgroup\else\psKiviatLine@iii#2,#3\@nil\fi} +% +\def\psKiviatTicklines{\pst@object{psKiviatTicklines}} +\def\psKiviatTicklines@i#1#2{{% n, radius + \degrees[#1]% + \use@par% + \pstFPDiv\pst@tempN{#2}{\psk@Dx}% + \pst@cntm=\pst@tempN \advance\pst@cntm by \m@ne + \multido{\rA=\psk@Dx+\psk@Dx}{\the\pst@cntm}{% + \def\pst@Coordinates{}% + \psLoop{#1}{\xdef\pst@Coordinates{\pst@Coordinates(\rA;\the\psLoopIndex)}}% + \rput{\psk@@rotate}(0,0){\expandafter\pspolygon\pst@Coordinates}% + }% +}\ignorespaces}% +% +\def\psKiviatAxes{\pst@object{psKiviatAxes}} +\def\psKiviatAxes@i#1#2{{% + \degrees[#1] + \use@par% + \multido{\iA=0+1}{#1}{\rput{\psk@@rotate}(0,0){\psline(0,0)(#2;\iA)}}% + }\ignorespaces}% +% \def\resetOptions{% \def\pst@linetype{0}% \pstScalePoints(1,1){}{}% |