diff options
author | Karl Berry <karl@freefriends.org> | 2008-06-14 23:12:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-06-14 23:12:32 +0000 |
commit | f8cc855cd0280fbde00de48149d235af253554fd (patch) | |
tree | d46c2dcb1fec82b2650f38151315fb6f72d9e728 /Master | |
parent | 1b839cac605520b4304daee2b100f17d559d70fd (diff) |
pstricks-add update (14jun08)
git-svn-id: svn://tug.org/texlive/trunk@8737 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/generic/pstricks-add/Changes | 5 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf | bin | 1669803 -> 1650157 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex | 1626 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex | 338 |
4 files changed, 1055 insertions, 914 deletions
diff --git a/Master/texmf-dist/doc/generic/pstricks-add/Changes b/Master/texmf-dist/doc/generic/pstricks-add/Changes index 3ebbd17c231..5c7229efbdb 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 24 2008-05-16 18:33:45Z herbert $ +%% $Id: Changes 25 2008-06-06 10:33:45Z herbert $ %% pstricks-add.pro ----------- (Dominik Rodriguez/hv) v 0.20 2008-01-12 - moved the AlgParser into pst-algparser.pro @@ -33,6 +33,9 @@ pstricks-add.sty ----------- (hv) pstricks-add.tex ----------- (Dominik Rodriguez/hv) + v 3.05 2008-06-06 - rewrote the axes-label setting for the psgraph environment + - add \pst@mindim{#1}{#2}#3 + - rewrote label setting for \psaxes v 3.04 2008-06-02 - make \pslinewidth and \psfillstyle available in \psbrace v 3.03 2008-05-20 - fix introduced bug with ps.pro v 3.02 2008-04-25 - set correct labelFontSize for math mode 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 58e9702f744..1230a783c89 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 5014cd7dea0..c67b049d350 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,5 +1,5 @@ -%% $Id: pstricks-add-doc.tex 24 2008-05-16 18:33:45Z herbert $ -\documentclass[12pt]{article} +%% $Id: pstricks-add-doc.tex 25 2008-06-06 10:33:45Z herbert $ +\documentclass[10pt]{article} \listfiles \usepackage{filecontents} \begin{filecontents*}{demo0.dat} @@ -972,8 +972,10 @@ \usepackage[T1]{fontenc} \usepackage[latin1]{inputenc} -\usepackage{pamathx} -\usepackage[scaled]{luximono} +%\usepackage{mathpazo} +%\usepackage{pamathx} +%\usepackage[scaled]{luximono} +\usepackage{arev} %\usepackage{mathptmx} \usepackage[lmargin=2.5cm,bmargin=3cm]{geometry} \usepackage{tabularx} @@ -1195,6 +1197,22 @@ It makes some sense to define a new macroname in the preamble to use it througho \end{LTXexample} %-------------------------------------------------------------------------------------- +\subsection{\CMD{pst\textat{}mindim}} +%-------------------------------------------------------------------------------------- + +\begin{lstlisting}[style=syntax] +\pst@mindim{<dimension>}{<dimension>}{<result as dimension register>} +\end{lstlisting} + +\begin{LTXexample}[width=2cm] +\newdimen\minDim +\makeatletter +\pst@mindim{34cm}{1234pt}\minDim \the\minDim\\ +\pst@mindim{34cm}{123pt}\minDim \the\minDim +\makeatother +\end{LTXexample} + +%-------------------------------------------------------------------------------------- \subsection{\CMD{pst\textat{}abs}} %-------------------------------------------------------------------------------------- @@ -1226,6 +1244,7 @@ It makes some sense to define a new macroname in the preamble to use it througho \makeatother \end{LTXexample} +\clearpage %-------------------------------------------------------------------------------------- \section{Dashed Lines} %-------------------------------------------------------------------------------------- @@ -1272,6 +1291,8 @@ with \verb+rmultiput+: \end{pspicture} \end{LTXexample} +\clearpage + %-------------------------------------------------------------------------------------- \section{\CMD{psrotate}: Rotating objects} %-------------------------------------------------------------------------------------- @@ -1314,7 +1335,7 @@ macro. \end{LTXexample} -\begin{LTXexample}[pos=t,wide] +\begin{LTXexample}[pos=t] \def\majorette{\psline[linewidth=0.5mm](0,2)% Idea by Manuel Luque \pscircle[fillstyle=solid]{0.1} \pscircle[fillstyle=solid](0,2){0.1}} @@ -1423,7 +1444,7 @@ and can be used by the user for coloring lines or text. \end{pspicture} \end{LTXexample} - +\clearpage %-------------------------------------------------------------------------------------- \section{\CMD{psHomothetie}: central dilatation} %-------------------------------------------------------------------------------------- @@ -1562,7 +1583,7 @@ or \verb|t| (top), where the default is \verb|c|, the center of the object. \end{LTXexample} -\begin{LTXexample}[width=8cm,wide] +\begin{LTXexample}[width=8cm] \psset{unit=0.8} \begin{pspicture}(10,11) \psgrid[subgriddiv=0,griddots=10] @@ -1588,7 +1609,7 @@ or \verb|t| (top), where the default is \verb|c|, the center of the object. %$ -\begin{LTXexample}[wide,width=5cm] +\begin{LTXexample}[width=5cm] \[ \begin{pmatrix} \Rnode[vref=2ex]{A}{~1} \\ @@ -1609,7 +1630,6 @@ It is also possible to put a vertical brace around a default paragraph. This wor with setting two invisible nodes at the beginning and the end of the paragraph. Inentation is possible with a minipage. -\begin{framed} Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. @@ -1646,10 +1666,8 @@ Some nonsense text, which is nothing more than nonsense. \vspace*{-2ex} \noindent\rnode{B}{}\psbrace[linecolor=red](A)(B){} \end{minipage} -\end{framed} \begin{lstlisting} -\begin{framed} Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. @@ -1685,7 +1703,6 @@ Some nonsense text, which is nothing more than nonsense. \vspace*{-2ex}\noindent\rnode{B}{}\psbrace[linecolor=red](A)(B){} \end{minipage} -\end{framed} \end{lstlisting} \clearpage @@ -1907,7 +1924,6 @@ is like the one described in the old PSTricks manual. -\clearpage \subsection{\texttt{hookarrow}} \begin{LTXexample} \psset{arrowsize=8pt,arrowlength=1,linewidth=1pt,nodesep=2pt,shortput=tablr} @@ -2347,7 +2363,6 @@ All examples are printed with \verb|\psset{arrowscale=2,linecolor=red}|. \end{LTXexample} -\clearpage %-------------------------------------------------------------------------------------- \subsubsection{\CMD{pcline}} @@ -3278,15 +3293,15 @@ There is no special parameter here. \begin{LTXexample}[width=5.5cm] \psset{unit=0.5cm} \begin{pspicture}(-5,-4)(5,5) - \psaxes{->}(0,0)(-5,-4)(5,5) + \psaxes[labelFontSize=\scriptstyle]{->}(0,0)(-5,-4)(5,5) \psline[linecolor=red,linewidth=2pt](-5,-1)(5,5) \psline[linecolor=blue,linewidth=2pt](-5,3)(5,-4) - \qdisk(-5,-1){3pt}\uput[-90](-5,-1){A} - \qdisk(5,5){3pt}\uput[-90](5,5){B} - \qdisk(-5,3){3pt}\uput[-90](-5,3){C} - \qdisk(5,-4){3pt}\uput[-90](5,-4){D} + \qdisk(-5,-1){2pt}\uput[-90](-5,-1){A} + \qdisk(5,5){2pt}\uput[-90](5,5){B} + \qdisk(-5,3){2pt}\uput[-90](-5,3){C} + \qdisk(5,-4){2pt}\uput[-90](5,-4){D} \psIntersectionPoint(-5,-1)(5,5)(-5,3)(5,-4){IP} - \qdisk(IP){5pt}\uput{0.3}[90](IP){IP} + \qdisk(IP){3pt}\uput{0.3}[90](IP){IP} \psline[linestyle=dashed](IP|0,0)(IP)(0,0|IP) \end{pspicture} \end{LTXexample} @@ -3403,14 +3418,21 @@ package, because everything can be set by the \verb+ticksize+ option. When using shouldn't be redefined, because the package does it itself in these cases. { \ttfamily -\rowcolors{0}{blue!20}{red!30} +\rowcolors{1}{blue!20}{red!30} \begin{longtable}{lll} \caption{All new parameters for \texttt{pst-plot}}\\[-5pt] -\textrm{Name} & \textrm{Type} & \textrm{Default}\\\hline +\rowcolor{white}\textrm{\bfseries Name} & \textrm{\bfseries Type} & \textrm{\bfseries Default}\\\hline \endfirsthead -\textrm{Name} & \textrm{Type} & \textrm{Default}\\\hline +\rowcolor{white}\textrm{\bfseries Name} & \textrm{\bfseries Type} & \textrm{\bfseries Default}\\\hline \endhead +labels & <all|x|y|none> & all\\%ok +xlabelPos & <bottom,axis,top>& bottom\\ +ylabelPos & <left,axis,right>& left\\ +xlabelFactor & <anything> & \{\textbackslash\@ empty\}\\ +ylabelFactor & <anything> & \{\textbackslash\@ empty\}\\ labelFontSize & <fontsize macro> & \{\} \\ +trigLabels & false|true & false\\ +trigLabelBase & <number> & 0\\ algebraic & false|true & false\\ %ok comma & false|true & false\\ %ok xAxis & false|true & true\\%ok @@ -3424,7 +3446,6 @@ xyDecimals & <number> or empty & \{\}\\%ok %xyLabel & <anything> & \{\}\\%ok %tickstyle & full|top|bottom & full\\%ok ticks & <all|x|y|none> & all\\%ok -labels & <all|x|y|none> & all\\%ok subticks & <number> & 0\\ xsubticks & <number> & 0\\ ysubticks & <number> & 0\\ @@ -3440,8 +3461,6 @@ xsubtickcolor & <color> & darkgray\\ ysubtickcolor & <color> & darkgray\\ ticklinestyle & solid | dashed | dotted | none & solid\\ subticklinestyle & solid | dashed | dotted | none & solid\\ -xlabelFactor & <anything> & \{\textbackslash\@ empty\}\\ -ylabelFactor & <anything> & \{\textbackslash\@ empty\}\\ xlogBase & <number> or empty & \{\}\\ ylogBase & <number> or empty & \{\}\\ xylogBase & <number> or empty & \{\}\\ @@ -3467,26 +3486,158 @@ lly & <length> & 0pt\\ urx & <length> & 0pt\\ ury & <length> & 0pt\\ polarplot & false|true & false\\ -trigLabels & false|true & false\\ -trigLabelBase & <number> & 0\\ ChangeOrder & false|true & false\\ \end{longtable} } \clearpage + +%-------------------------------------------------------------------------------------- +\subsection{\texttt{xyAxes}, \texttt{xAxis} and \texttt{yAxis}} +%-------------------------------------------------------------------------------------- +Syntax: +\begin{lstlisting}[style=syntax] +xyAxes=true|false +xAxis=true|false +yAxis=true|false +\end{lstlisting} + +Sometimes there is only a need for one axis with ticks. In this case you can set one +of the following options to false. The \verb+xyAxes+ makes only sense, when you want +to set both, x and y to true with only one command again to the default, because with +\verb+xyAxes=false+ you get nothing with the \verb+psaxes+ macro. + + +\resetOptions% +\begin{LTXexample} +\begin{pspicture}(5,1) +\psaxes[yAxis=false,linecolor=blue]{->}(0,0.5)(5,0.5) +\end{pspicture} +\begin{pspicture}(1,5) +\psaxes[xAxis=false,linecolor=red]{->}(0.5,0)(0.5,5) +\end{pspicture} +\begin{pspicture}(1,5) +\psaxes[xAxis=false,linecolor=red, + ylabelPos=right]{->}(0.5,0)(0.5,5) +\end{pspicture}\\[0.5cm] +\begin{pspicture}(5,1) +\psaxes[yAxis=false,linecolor=blue, + xlabelPos=top]{->}(0,0.5)(5,0.5) +\end{pspicture} +\end{LTXexample} + +As seen in the example, a single y axis gets the labels on the left side. This can be +changed with the option \verb+ylabelPos+ or with \verb+xlabelPos+ for the +x-axis. + + +%-------------------------------------------------------------------------------------- +\subsection{\texttt{labels}} +%-------------------------------------------------------------------------------------- +Syntax: +\begin{lstlisting}[style=syntax] +labels=all|x|y|none +\end{lstlisting} + +This option is also already in the \verb+pst-plot+ package and only mentioned here for +some completness. + +\begin{LTXexample}[width=3.5cm] +\psset{ticksize=6pt} +\begin{pspicture}(-1,-1)(2,2) +\psaxes[labels=all,subticks=5]{->}(0,0)(-1,-1)(2,2) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=3.5cm] +\begin{pspicture}(-1,-1)(2,2) +\psaxes[labels=y,subticks=5]{->}(0,0)(-1,-1)(2,2) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=3.5cm] +\begin{pspicture}(-1,-1)(2,2) +\psaxes[labels=x,subticks=5]{->}(0,0)(2,2)(-1,-1) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=3.5cm] +\begin{pspicture}(-1,-1)(2,2) +\psaxes[labels=none,subticks=5]{->}(0,0)(2,2)(-1,-1) +\end{pspicture} +\end{LTXexample} + + + +%-------------------------------------------------------------------------------------- +\subsection{\texttt{xlabelPos} and \texttt{xlabelPos}} +%-------------------------------------------------------------------------------------- +Syntax: +\begin{lstlisting}[style=syntax] +xlabelPos=bottom|axis|top +ylabelPos=left|axis|right +\end{lstlisting} + +By default the labels for ticks are placed at the bottom (x axis) and left (y-axis). +In both axes are drawn into negative direction the default is top (x axis) and right (y axis). +It be changed with the two options \texttt{xlabelPos} and \texttt{xlabelPos}. With the value +\texttt{axis} the user can place the labels depending to the value of \texttt{labelsep}, +which is taken into account. + +\resetOptions% +\bigskip +\begin{LTXexample}[width=9cm] +\begin{pspicture}(3,3) +\psaxes{->}(3,3) +\end{pspicture}\hspace{2cm} +\begin{pspicture}(3,-3) +\psaxes[xlabelPos=top]{->}(3,-3) +\end{pspicture} +\end{LTXexample} + +\vspace{1cm} +\begin{LTXexample}[width=9cm] +\begin{pspicture}(-3,-3) +\psaxes{->}(-3,-3) +\end{pspicture}\hspace{2cm} +\begin{pspicture}(3,3) +\psaxes[ylabelPos=axis, + xlabelPos=axis]{->}(3,3) +\end{pspicture} +\end{LTXexample} + +\vspace{1cm} +\begin{LTXexample}[width=5cm] +\begin{pspicture}(-1,1)(3,-3) +\psaxes[xlabelPos=top, + xticksize=0 20pt, + yticksize=-20pt 0]{->}(3,-3) +\end{pspicture} +\end{LTXexample} + + + + %-------------------------------------------------------------------------------------- -\subsection{Changing the label font size with \texttt{labelFontSize}} +\subsection{Changing the label font size with \texttt{labelFontSize} and \texttt{mathLabel}} %-------------------------------------------------------------------------------------- -This option sets the horizontal \textbf{and} vertical font size for the labels. +This option sets the horizontal \textbf{and} vertical font size for the labels depending to +the option \verb+mathLabel+ for the text or the math mode. It will be overwritten when another package or a user defines \begin{lstlisting}[style=syntax] -\def\pshlabel#1{...} -\def\psvlabel#1{...} +\def\pshlabel#1{\labelFontSize ...} +\def\psvlabel#1{\labelFontSize ...} +\def\pshlabel#1{$\labelFontSize ...$}% for mathLabel=true (default) +\def\psvlabel#1{$\labelFontSize ...$}% for mathLabel=true (default) \end{lstlisting} +in another way. Pay attention, that for \verb+mathLabel=true+ the font size must be set +by one of the mathematical styles \verb+\textstyle+, \verb+\displaystyle+, \verb+\scriptstyle+, +or \verb+\scriptscriptstyle+. \begin{LTXexample}[width=6cm] +\psset{mathLabel=false} \begin{pspicture}(-0.25,-0.25)(5,2.25) \psaxes{->}(5,2.25)[$x$,0][$y$,90] \end{pspicture}\\[20pt] @@ -3496,315 +3647,432 @@ It will be overwritten when another package or a user defines \begin{pspicture}(-0.25,-0.25)(5,2.25) \psaxes[labelFontSize=\footnotesize]{->}(5,2.25) \end{pspicture}\\[20pt] -\begin{pspicture}(-0.25,-0.25)(5,2.25) -\psaxes[labelFontSize=\tiny]{->}(5,2.25)[\textbf{x},-90][\textbf{y},0] -\end{pspicture}% \end{LTXexample} +\begin{LTXexample}[width=6cm] +\begin{pspicture}(-0.25,-0.25)(5,2.25) +\psaxes[labelFontSize=\scriptstyle]{->}(5,2.25)[\textbf{x},-90][\textbf{y},0] +\end{pspicture}\\[20pt] +\psset{mathLabel=true} +\begin{pspicture}(-0.25,-0.25)(5,2.25) +\psaxes[labelFontSize=\scriptscriptstyle]{->}(5,2.25) +\end{pspicture}\\[20pt] +\end{LTXexample} -\clearpage %-------------------------------------------------------------------------------------- -\subsection[\texttt{algebraic}]{\texttt{algebraic}\footnote{This part is adapted - from the package \texttt{pst-eqdf}, written by Dominique Rodriguez.}} +\subsection{\texttt{xlabelFactor} and \texttt{ylabelFactor}} %-------------------------------------------------------------------------------------- -By default the function of \verb+\psplot+ has to be described in Reversed Polish Notation. -The option \verb+algebraic+ allows to do this in the common algebraic notation. E.g.: +When having big numbers as data records then it makes sense to write the values +as ${<number>\cdot 10^{<exp>}}$. These new options allow to define the additional part +of the value, but it must be set in math mode when using math operators! -\begin{tabular}{l|l} -RPN & algebraic\\\hline -\verb+x ln+ & \verb+ln(x)+\\ -\verb+x cos 2.71 x neg 10 div exp mul+ & \verb+cos(x)*2.71^(-x/10)+\\ -\verb+1 x div cos 4 mul+ & \verb+4*cos(1/x)+\\ -\verb+t cos t sin+ & \verb+cos(t)|sin(t)+ -\end{tabular} +\resetOptions +\begin{LTXexample} +\readdata{\data}{demo1.dat} +\pstScalePoints(1,0.000001){}{}% (x,y){additional x operator}{y op} +\psset{llx=-1cm,lly=-1cm} +\psgraph[ylabelFactor=\cdot 10^6,Dx=5,Dy=100](0,0)(25,750){8cm}{5cm} + \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} +\endpsgraph +\pstScalePoints(1,1){}{}% reset +\end{LTXexample} -Setting the option \verb$algebraic$ to \verb$true$, allow the user to describe all -expression to be written in the classical algebraic notation (infix notation). The four arithmetic -operarions are obviously defined \verb$+-*/$, and also the exponential operator -\verb$^$. The natural priorities are used : $3+4\times 5^5=3+(4\times (5^5))$, and by default -the computation is done from left to right. The following functions are defined : -\medskip -\begin{tabular}{ll} -\verb$sin$, \verb$cos$, \verb$tan$, \verb$acos$, \verb$asin$ & in radians\\ -\verb$log$, \verb$ln$\\ -\verb$ceiling$, \verb$floor$, \verb$truncate$, \verb$round$\\ -\verb$sqrt$ & square root\\ -\verb$abs$ & absolute value\\ -\verb$fact$ & for the factorial\\ -\verb$Sum$ & for building sums\\ -\verb$IfTE$ & for an easy case structure -\end{tabular} +\clearpage +%-------------------------------------------------------------------------------------- +\subsection{\texttt{comma}} +%-------------------------------------------------------------------------------------- +Syntax: +\begin{lstlisting}[style=syntax] +comma=false|true +\end{lstlisting} +Setting this option to true gives labels with a comma as a decimal separator instead +of the dot. \verb|comma| and \verb|comma=true| is the same. +\resetOptions \medskip -These options can be used with \textbf{all} plot macros. +\begin{LTXexample}[width=5.5cm] +\begin{pspicture}(-0.5,-0.5)(5,5.5) +\psaxes[Dx=1.5,comma,Dy=0.75,dy=0.75]{->}(5,5) +\psplot[linecolor=red,linewidth=3pt]{0}{4.5}% + {x RadtoDeg cos 2 mul 2.5 add} +\psline[linestyle=dashed](0,2.5)(4.5,2.5) +\end{pspicture} +\end{LTXexample} -{\bfseries Using the option \verb+algebraic+ implies that all angles have to be used in the -radian unit! } +%-------------------------------------------------------------------------------------- +\subsection{\texttt{xyDecimals}, \texttt{xDecimals} and \texttt{yDecimals}} +%-------------------------------------------------------------------------------------- +Syntax: +\begin{lstlisting}[style=syntax] +xyDecimals=<number> +xDecimals=<any> +yDecimals=<any> +\end{lstlisting} +By default the labels of the axes get numbers with or without decimals, just depending to the +numbers. With these options \verb|??Decimals| it is possible to determine the decimals, +where the option \verb|xyDecimals| sets this identical for both axes. +The default setting \verb|{}| means, that you'll get the standard behaviour. -For the \verb+\parametricplot+ the two parts must be divided by the \verb+|+ character: -\begin{LTXexample}[width=2cm] -\begin{pspicture}(-0.5,-0.5)(0.5,0.5) -\parametricplot[algebraic,linecolor=red]{-3.14}{3.14}{cos(t)|sin(t)} +\begin{LTXexample}[width=6cm] +\begin{pspicture}(-1.5,-0.5)(5,3.75) + \psaxes[xyDecimals=2]{->}(0,0)(4.5,3.5) +\end{pspicture} +\end{LTXexample} + + +\begin{LTXexample}[pos=t] +\psset{xunit=10cm,yunit=0.01cm,labelFontSize=\footnotesize} +\begin{pspicture}(-0.3,-150)(1.5,550.0) + \psaxes[Dx=0.25,Dy=100,ticksize=-4pt 0,comma=true,xDecimals=3,yDecimals=1]{->}% + (0,0)(0,-100)(1.4,520)[\textbf{Amp\`ere},-90][\textbf{Voltage},0] \end{pspicture} \end{LTXexample} +\resetOptions + +%-------------------------------------------------------------------------------------- +\subsection{\texttt{trigLabels} and \texttt{trigLabelBase} -- axis with trigonmetrical units} +%-------------------------------------------------------------------------------------- +With the option \verb+trigLabels=true+ the labels on the x axis are trigonometrical ones. +The option \verb+trigLabelBase+ set the demoninator of fraction. The default value of +0 is the same as no fraction. +The following constants are are defined in the package: +\begin{lstlisting}[style=syntax] +\def§\ON§\psPiFour§\OFF§{12.566371} +\def§\ON§\psPiTwo§\OFF§{6.283185} +\def§\ON§\psPi§\OFF§{3.14159265} +\def§\ON§\psPiH§\OFF§{1.570796327} +\newdimen\pstRadUnit +\newdimen\pstRadUnitInv +§\ON§\pstRadUnit§\OFF§=1.047198cm % this is pi/3 +§\ON§\pstRadUnitInv§\OFF§=0.95493cm % this is 3/pi +\end{lstlisting} + + + +Because it is a bit complicating to set the right values, we show some more examples +here. + +For \textbf{all} following examples in this section we did a +global + +\lstinline[frame=single]|\psset{trigLabels=true,labelFontSize=\small}|. + + +\psset{trigLabels,labelFontSize=\small} +Translating the decimal ticks to geometrical makes no real sense, +because every 1 xunit (1cm) is a tick and the last one at 6cm. \clearpage -\bigskip -%\begin{LTXexample}[pos=t] -\psset{lly=-0.5cm} -\psgraph(-10,-3)(10,2){\linewidth}{6cm} - \psset{algebraic, plotpoints=101} - \psplot[linecolor=yellow, linewidth=4\pslinewidth]{-10}{10}{2*sin(x)}% - \psplot[linecolor=red, showpoints=true]{-10}{10}{2*sin(x)} -\endpsgraph -%\end{LTXexample} +\begin{minipage}{0.4\fullWidth} +\begin{pspicture}[trigLabels=true](-0.5,-1.25)(6.5,1.25)% + \pnode(5,0){A}% + \psaxes{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25)% +\end{pspicture} +\end{minipage}% +\begin{minipage}{0.6\fullWidth} +\begin{lstlisting} +\begin{pspicture}(-0.5,-1.25)(6.5,1.25)% + \pnode(5,0){A}% + \psaxes{->}(0,0)(-.5,-1.25)(\psPiTwo,1.25) +\end{pspicture} +\end{lstlisting} +\end{minipage} -\bigskip +\begin{minipage}{0.4\fullWidth} +\begin{pspicture}(-0.5,-1.25)(6.5,1.25)% + \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) +\end{pspicture} +\end{minipage}% +\begin{minipage}{0.6\fullWidth} \begin{lstlisting} -\psset{lly=-0.5cm} -\psgraph(-10,-3)(10,2){\linewidth}{6cm} - \psset{algebraic,plotpoints=101} - \psplot[linecolor=yellow, linewidth=4\pslinewidth]{-10}{10}{2*sin(x)}% - \psplot[linecolor=red, showpoints=true]{-10}{10}{2*sin(x)} -\endpsgraph +\begin{pspicture}(-0.5,-1.25)(10,1.25)% + \psaxes[§\ON§trigLabelBase=3§\OFF§]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) +\end{pspicture} \end{lstlisting} +\end{minipage} -\bigskip -%\begin{LTXexample}[pos=t] -\bgroup -\psset{lly=-0.5cm} -\psgraph(0,-5)(18,3){15cm}{5cm} - \psset{algebraic,plotpoints=501} - \psplot[linecolor=yellow, linewidth=4\pslinewidth]{0.01}{18}{ln(x)}% - \psplot[linecolor=red]{0.01}{18}{ln(x)} - \psplot[linecolor=yellow,linewidth=4\pslinewidth]{0}{18}{3*cos(x)*2.71^(-x/10)} - \psplot[linecolor=blue,showpoints=true,plotpoints=51]{0}{18}{3*cos(x)*2.71^(-x/10)} -\endpsgraph -\egroup -%\end{LTXexample} +Modifing the ticks to have the last one exactly at the end is possible +with a different dx value ($\frac{\pi}{3}\approx 1.047$): + + +\begin{minipage}{0.4\fullWidth} +\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(\psPiTwo,0){C}% + \psaxes[dx=\pstRadUnit]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) +\end{pspicture}% +\end{minipage}% +\begin{minipage}{0.6\fullWidth} +\begin{lstlisting} +\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(\psPiTwo,0){C}% + \psaxes[§\ON§dx=\pstRadUnit§\OFF§]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) +\end{pspicture}% +\end{lstlisting} +\end{minipage} + + +\begin{minipage}{0.4\fullWidth} +\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(5,0){B}% + \psaxes[dx=\pstRadUnit,trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) +\end{pspicture}% +\end{minipage}% +\begin{minipage}{0.6\fullWidth} +\begin{lstlisting} +\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(5,0){B}% + \psaxes[dx=\pstRadUnit,§\ON§trigLabelBase=3§\OFF§] {->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) +\end{pspicture}% +\end{lstlisting} +\end{minipage} + +\ncline[linestyle=dashed,linewidth=0.4pt]{A}{B} + +Set globaly everything in radiant unit. Now 6 units on the $x$-axis +are $6\pi$. Using \verb+trigLabelBase=3+ reduces this value to $2\pi$, a.s.o. \bigskip +\begin{minipage}{0.4\fullWidth} +\psset{xunit=\pstRadUnit}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(6,0){D}% + \psaxes{->}(0,0)(-0.5,-1.25)(6.5,1.25)% +\end{pspicture}% +\end{minipage}% +\begin{minipage}{0.6\fullWidth} \begin{lstlisting} -\psset{lly=-0.5cm} -\psgraph(0,-5)(18,3){15cm}{5cm} - \psset{algebraic,plotpoints=501} - \psplot[linecolor=yellow, linewidth=4\pslinewidth]{0.01}{18}{ln(x)}% - \psplot[linecolor=red]{0.01}{18}{ln(x)} - \psplot[linecolor=yellow,linewidth=4\pslinewidth]{0}{18}{3*cos(x)*2.71^(-x/10)} - \psplot[linecolor=blue,showpoints=true,plotpoints=51]{0}{18}{3*cos(x)*2.71^(-x/10)} -\endpsgraph +\psset{§\ON§xunit=\pstRadUnit§\OFF§}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(6,0){D}% + \psaxes{->}(0,0)(-0.5,-1.25)(6.5,1.25)% +\end{pspicture}% \end{lstlisting} +\end{minipage} +\ncline[linestyle=dashed,linewidth=0.4pt]{C}{D} +\begin{minipage}{0.4\fullWidth} +\psset{xunit=\pstRadUnit}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) +\end{pspicture}% +\end{minipage}% +\begin{minipage}{0.6\fullWidth} +\begin{lstlisting} +\psset{§\ON§xunit=\pstRadUnit§\OFF§}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[§\ON§trigLabelBase=3§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) +\end{pspicture}% +\end{lstlisting} +\end{minipage} -\clearpage -%-------------------------------------------------------------------------------------- -\subsubsection{Using the \texttt{Sum} function} -%-------------------------------------------------------------------------------------- -Syntax: \verb+Sum(<index name>,<start>,<step>,<end>,<function>)+ -Let's plot the first development of cosine with polynomials: -$\displaystyle\sum_{n=0}^{+\infty}\frac{(-1)^nx^{2n}}{n!}$. +\begin{minipage}{0.4\fullWidth} +\psset{xunit=\pstRadUnit}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[trigLabelBase=4]{->}(0,0)(-0.5,-1.25)(6.5,1.25) +\end{pspicture}% +\end{minipage}% +\begin{minipage}{0.6\fullWidth} +\begin{lstlisting} +\psset{§\ON§xunit=\pstRadUnit§\OFF§}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[§\ON§trigLabelBase=4§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) +\end{pspicture}% +\end{lstlisting} +\end{minipage} -\begin{center} -\bgroup -\psset{algebraic, plotpoints=501, yunit=3} -\def\getColor#1{\ifcase#1 black\or red\or magenta\or yellow\or green\or Orange\or blue\or - DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\fi} -\begin{pspicture}(-7,-1.5)(7,1.5) - \psclip{\psframe(-7,-1.5)(7,1.5)} - \psplot{-7}{7}{cos(x)} - \multido{\n=1+1}{10}{% - \psplot[linewidth=1pt,linecolor=\getColor{\n}]{-7}{7}{% - Sum(ijk,0,1,\n,(-1)^ijk*x^(2*ijk)/fact(2*ijk))}} - \endpsclip - \psaxes(0,0)(-7,-1.5)(7,1.5) -\end{pspicture} -\egroup -\end{center} +\begin{minipage}{0.4\fullWidth} +\psset{xunit=\pstRadUnit}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[trigLabelBase=6]{->}(0,0)(-0.5,-1.25)(6.5,1.25) +\end{pspicture}% +\end{minipage}% +\begin{minipage}{0.6\fullWidth} \begin{lstlisting} -\psset{algebraic, plotpoints=501, yunit=3} -\def\getColor#1{\ifcase#1 black\or red\or magenta\or yellow\or green\or Orange\or blue\or - DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\fi} -\begin{pspicture}(-7,-1.5)(7,1.5) - \psclip{\psframe(-7,-1.5)(7,1.5)} - \psplot{-7}{7}{cos(x)} - \multido{\n=1+1}{10}{% - \psplot[linewidth=1pt,linecolor=\getColor{\n}]{-7}{7}{% - Sum(ijk,0,1,\n,(-1)^ijk*x^(2*ijk)/fact(2*ijk))}} - \endpsclip - \psaxes(0,0)(-7,-1.5)(7,1.5) -\end{pspicture} +\psset{§\ON§xunit=\pstRadUnit§\OFF§}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[§\ON§trigLabelBase=6§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) +\end{pspicture}% \end{lstlisting} +\end{minipage} -\clearpage -%-------------------------------------------------------------------------------------- -\subsubsection{Using the \texttt{IfTE} function} -%-------------------------------------------------------------------------------------- -Syntax: \verb+IfTE(<condition>,<true part>,<false part>)+ -Nesting of several \verb+IfTE+ are possible and seen in the following examples. -A classical example is a piece wise linear function. -\begin{center} -\begin{pspicture}(-7.5,-2.5)(7.5,6)\psgrid[subgriddiv=1,gridcolor=lightgray] - \psset{algebraic=true, plotpoints=21,linewidth=2pt} - \psplot[linecolor=blue]{-7.5}{7.5}{IfTE(x<-6,8+x,IfTE(x<0,-x/3,IfTE(x<3,2*x,9-x)))} - \psplot[linecolor=red, plotpoints=101]{-7.5}{7.5}{% - IfTE(2*x<-2^2*sqrt(9),7+x,IfTE(x<0,x^2/18-1,IfTE(x<3,2*x^2/3-1,8-x)))}% +The best way seems to be setting the $x$-unit to \verb+\pstRadUnit+. Plotting a +function doesn't consider the value for \verb+trigLabelBase+, it has to be done by +the user. The first example sets the unit locally for the \verb+\psplot+ +back to 1cm, which is needed, because we use this unit on PostScript side. + +\begin{minipage}{0.4\fullWidth} +\psset{xunit=\pstRadUnit}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) + \psplot[xunit=1cm,linecolor=red,linewidth=1.5pt]{0}{\psPiTwo}{x RadtoDeg sin} \end{pspicture} -\end{center} +\end{minipage}% +\begin{minipage}{0.6\fullWidth} +\begin{lstlisting} +\psset{xunit=\pstRadUnit}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) + \psplot[§\ON§xunit=1cm§\OFF§,linecolor=red,linewidth=1.5pt]{0}{§\ON§\psPiTwo§\OFF§}{x RadtoDeg sin} +\end{pspicture} +\end{lstlisting} +\end{minipage} +\begin{minipage}{0.4\fullWidth} +\psset{xunit=\pstRadUnit}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) + \psplot[linecolor=red,linewidth=1.5pt]{0}{6}{x Pi 3 div mul RadtoDeg sin} +\end{pspicture} +\end{minipage}% +\begin{minipage}{0.6\fullWidth} \begin{lstlisting} -\begin{pspicture}(-7.5,-2.5)(7.5,6)\psgrid[subgriddiv=1,gridcolor=lightgray] - \psset{algebraic=true, plotpoints=21,linewidth=2pt} - \psplot[linecolor=blue]{-7.5}{7.5}{IfTE(x<-6,8+x,IfTE(x<0,-x/3,IfTE(x<3,2*x,9-x)))} - \psplot[linecolor=red, plotpoints=101]{-7.5}{7.5}{% - IfTE(2*x<-2^2*sqrt(9),7+x,IfTE(x<0,x^2/18-1,IfTE(x<3,2*x^2/3-1,8-x)))}% +\psset{xunit=\pstRadUnit}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) + \psplot[linecolor=red,linewidth=1.5pt]{0}{6}{x §\ON§Pi 3 div mul §\OFF§RadtoDeg sin} \end{pspicture} \end{lstlisting} +\end{minipage} -When you program a piece-wise defined function you must take care that a -plotting point must be put on each point where the description changes. Use \verb+showpoints=true+ to -see what's going on, when there is a problem. You are on the save side, when you choose a -big number for \verb+plotpoints+. -\clearpage +\begin{minipage}{0.4\fullWidth} +\psset{xunit=\pstRadUnit}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[dx=1.5]{->}(0,0)(-0.5,-1.25)(6.5,1.25) + \psplot[xunit=.5cm,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin} +\end{pspicture} +\end{minipage}% +\begin{minipage}{0.6\fullWidth} +\begin{lstlisting} +\psset{xunit=\pstRadUnit}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[§\ON§dx=1.5§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) + \psplot[§\ON§xunit=0.5cm§\OFF§,linecolor=red,linewidth=1.5pt]{0}{§\ON§\psPiFour§\OFF§}{x RadtoDeg sin} +\end{pspicture} +\end{lstlisting} +\end{minipage} -\begin{center} -\begin{pspicture}[showgrid=true](-8,-8)(8,8) - \psset{plotpoints=1000,linewidth=1pt} - \psplot[algebraic]{-8}{8}{ceiling(x)} - \psplot[algebraic, linecolor=yellow]{-8}{8}{rand/(2^31-1)+x} - \psplot[algebraic, linecolor=red]{-8}{8}{floor(x)} - \psplot[algebraic, linecolor=blue]{-8}{8}{round(x)} - \psplot[algebraic, linecolor=green]{-8}{8}{truncate(x)} - \psplot[algebraic, linecolor=cyan]{-8}{8}{div(mul(4,x),7)} - \psplot[algebraic, linecolor=gray]{-8}{8}{abs(x)+abs(x-3)-abs(5-5*x/7)} - \psplot[algebraic, linecolor=gray]{-8}{8}{abs(3*cos(x)+1)} - \psplot[algebraic, linecolor=magenta]{-8}{8}{floor(8*cos(x))} +\begin{minipage}{0.4\fullWidth} +\psset{xunit=\pstRadUnit}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[dx=0.75,trigLabelBase=2]{->}(0,0)(-0.5,-1.25)(6.5,1.25) + \psplot[xunit=.5cm,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin} \end{pspicture} -\end{center} - +\end{minipage}% +\begin{minipage}{0.6\fullWidth} \begin{lstlisting} -\begin{pspicture}[showgrid=true](-8,-8)(8,8) - \psset{plotpoints=1000,linewidth=1pt} - \psplot[algebraic, linecolor=yellow]{-8}{8}{rand/(2^31-1)+x} - \psplot[algebraic]{-8}{8}{ceiling(x)} - \psplot[algebraic, linecolor=red]{-8}{8}{floor(x)} - \psplot[algebraic, linecolor=blue]{-8}{8}{round(x)} - \psplot[algebraic, linecolor=green]{-8}{8}{truncate(x)} - \psplot[algebraic, linecolor=cyan]{-8}{8}{div(mul(4,x),7)} - \psplot[algebraic, linecolor=gray]{-8}{8}{abs(x)+abs(x-3)-abs(5-5*x/7)} - \psplot[algebraic, linecolor=gray]{-8}{8}{abs(3*cos(x)+1)} - \psplot[algebraic, linecolor=magenta]{-8}{8}{floor(8*cos(x))} +\psset{xunit=\pstRadUnit}% +\begin{pspicture}(-0.5,-1.25)(6.5,1.25) + \psaxes[§\ON§dx=0.75§\OFF§,§\ON§trigLabelBase=2§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) + \psplot[§\ON§xunit=0.5cm§\OFF§,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin} \end{pspicture} \end{lstlisting} +\end{minipage} +It is also possible to set the $x$ unit and $dx$ value to get the labels +right. But this needs some more understanding how it really works. +A \verb+xunit=1.570796327+ sets the unit to $\pi/2$ and a \verb+dx=0.666667+ +then puts every $2/3$ of the unit a tick mark and a label. The length of +the $x$-axis is 6.4 units which is $6.4\cdot 1.570796327cm\approx 10cm$. +The function then is plotted from $0$ to $3\pi=9.424777961$. -%-------------------------------------------------------------------------------------- -\subsection{\texttt{comma}} -%-------------------------------------------------------------------------------------- -Syntax: -\begin{lstlisting}[style=syntax] -comma=false|true -\end{lstlisting} -Setting this option to true gives labels with a comma as a decimal separator instead -of the dot. \verb|comma| and \verb|comma=true| is the same. -\resetOptions -\medskip -\begin{LTXexample}[width=5.5cm] -\begin{pspicture}(-0.5,-0.5)(5,5.5) -\psaxes[Dx=1.5,Dy=0.5,comma]{->}(5,5) -\psplot[linecolor=red,linewidth=3pt]{0}{4.5}% - {x 180 mul 1.52 div cos 2 mul 2.5 add} -\psline[linestyle=dashed](0,2.5)(4.5,2.5) -\end{pspicture} -\end{LTXexample} -%-------------------------------------------------------------------------------------- -\subsection{\texttt{xyAxes}, \texttt{xAxis} and \texttt{yAxis}} -%-------------------------------------------------------------------------------------- -Syntax: -\begin{lstlisting}[style=syntax] -xyAxes=true|false -xAxis=true|false -yAxis=true|false +\begin{center} +\psset{unit=1cm} +\begin{pspicture}(-0.5,-1.25)(10,1.25) + \psaxes[xunit=1.570796327,showorigin=false,trigLabelBase=3,dx=0.666667]{->}(0,0)(-0.5,-1.25)(6.4,1.25) + \psplot[linecolor=red,linewidth=1.5pt]{0}{9.424777961}{% + x RadtoDeg dup sin exch 1.1 mul cos add} +\end{pspicture} +\end{center} +\begin{lstlisting} +\begin{pspicture}(-0.5,-1.25)(10,1.25) + \psaxes[§\ON§xunit=1.570796327§\OFF§,§\ON§trigLabelBase=3§\OFF§,§\ON§dx=0.666667§\OFF§]{->}(0,0)(-0.5,-1.25)(6.4,1.25) + \psplot[linecolor=red,linewidth=1.5pt]{0}{§\ON§9.424777961§\OFF§}{% + x RadtoDeg dup sin exch 1.1 mul cos add} +\end{pspicture} \end{lstlisting} -Sometimes there is only a need for one axis with ticks. In this case you can set one -of the following options to false. The \verb+xyAxes+ makes only sense, when you want -to set both, x and y to true with only one command again to the default, because with -\verb+xyAxes=false+ you get nothing with the \verb+psaxes+ macro. +\begin{center} +\psset{unit=1cm} +\begin{pspicture}(-0.5,-1.25)(10,1.25) + \psaxes[xunit=\psPi,dx=0.25]{->}(0,0)(-0.25,-1.25)(3.2,1.25) + \psplot[xunit=0.25,plotpoints=500,linecolor=red,linewidth=1.5pt]{0}{37.70}{% + x RadtoDeg dup sin exch 1.1 mul cos add} +\end{pspicture} +\end{center} +\begin{lstlisting} +\psset{§\ON§unit=1cm§\OFF§} + \psplot[§\ON§xunit=0.25§\OFF§,§\ON§plotpoints=500§\OFF§,linecolor=red,linewidth=1.5pt]{0}{37.70}{% + x RadtoDeg dup sin exch 1.1 mul cos add} +\end{pspicture} +\end{lstlisting} -\resetOptions% -\begin{LTXexample} -\begin{pspicture}(5,1) -\psaxes[yAxis=false,linecolor=blue]{->}(0,0.5)(5,0.5) +\begin{center} +\psset{unit=1cm} +\begin{pspicture}(-0.5,-2)(10,2) + \psplot[xunit=0.0625,linecolor=red,linewidth=1.5pt,plotpoints=5000]{0}{150.80}{% + x RadtoDeg dup sin exch 1.1 mul cos add} + \psaxes[xunit=\psPi,dx=0.5,Dx=8,subticks=2]{->}(0,0)(-0.1,-2)(3.2,2) \end{pspicture} -\begin{pspicture}(1,5) -\psaxes[xAxis=false,linecolor=red]{->}(0.5,0)(0.5,5) +\end{center} +\begin{lstlisting} +\psset{§\ON§unit=1cm§\OFF§} +\begin{pspicture}(-0.5,-1.25)(10,1.25) + \psplot[§\ON§xunit=0.0625§\OFF§,linecolor=red,linewidth=1.5pt,% + §\ON§plotpoints=5000§\OFF§]{0}{150.80}% + {x RadtoDeg dup sin exch 1.1 mul cos add} + \psaxes[§\ON§xunit=\psPi§\OFF§,§\ON§dx=0.5§\OFF§,§\ON§Dx=8§\OFF§]{->}(0,0)(-0.25,-1.25)(3.2,1.25) \end{pspicture} -\begin{pspicture}(1,5) -\psaxes[xAxis=false,linecolor=red]{->}(0.5,0)(0.5,5) -\end{pspicture}\hspace{2em} -\begin{pspicture}(1,5) -\psaxes[xAxis=false,linecolor=red,labelsep=-20pt]{->}(0.5,0)(0.5,5) -\end{pspicture}% -\begin{pspicture}(1,5) -\psaxes[xAxis=false,linecolor=red]{->}(0.5,0)(0.501,5) -\end{pspicture}% -\end{LTXexample} +\end{lstlisting} -As seen in the example, a single y axis gets the labels on the right side. This can be -changed in two ways, first with the option \verb+labelsep+ and second with a very -short and therefore invisible x-axis (right example). -%-------------------------------------------------------------------------------------- -\subsection{\texttt{xyDecimals}, \texttt{xDecimals} and \texttt{yDecimals}} -%-------------------------------------------------------------------------------------- -Syntax: -\begin{lstlisting}[style=syntax] -xyDecimals=<number> -xDecimals=<any> -yDecimals=<any> +\begin{center} +\psset{unit=1cm} +\begin{pspicture}(-7,-1.5)(7,1.5) + \psaxes[trigLabels=true,xunit=\psPi]{->}(0,0)(-2.2,-1.5)(2.2,1.5) + \psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin} +\end{pspicture} +\end{center} +\begin{lstlisting} +\begin{pspicture}(-7,-1.5)(7,1.5) + \psaxes[trigLabels=true,§\ON§xunit=\psPi§\OFF§]{->}(0,0)(-2.2,-1.5)(2.2,1.5) + \psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin} +\end{pspicture} \end{lstlisting} -By default the labels of the axes get numbers with or without decimals, just depending to the -numbers. With these options \verb|??Decimals| it is possible to determine the decimals, -where the option \verb|xyDecimals| sets this identical for both axes. -The default setting \verb|{}| means, that you'll get the standard behaviour. -\begin{LTXexample}[width=6cm] -\begin{pspicture}(-1.5,-0.5)(5,3.75) - \psaxes[xyDecimals=2]{->}(0,0)(4.5,3.5) +\begin{center} +\psset{unit=1cm} +\begin{pspicture}(-7,-1.5)(7,1.5) + \psaxes[trigLabels=true, + trigLabelBase=2,dx=\psPiH,xunit=\psPi]{->}(0,0)(-2.2,-1.5)(2.2,1.5) + \psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin} \end{pspicture} -\end{LTXexample} +\end{center} +\begin{lstlisting} +\begin{pspicture}(-7,-1.5)(7,1.5) + \psaxes[trigLabels=true, + trigLabelBase=2,dx=\psPiH,xunit=\psPi]{->}(0,0)(-2.2,-1.5)(2.2,1.5) + \psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin} +\end{pspicture} +\end{lstlisting} -\begin{LTXexample} -\psset{xunit=10cm,yunit=0.01cm,labelFontSize=\footnotesize} -\begin{pspicture}(-0.3,-150)(1.5,550.0) - \psaxes[Dx=0.25,Dy=100,ticksize=-4pt 0,comma=true,% - xDecimals=3,yDecimals=1]{->}(0,0)(0,-100)(1.4,520)% - [\textbf{Amp\`ere},-90][\textbf{Voltage},0] -\end{pspicture} -\end{LTXexample} +\psset{trigLabels=false} + -\resetOptions %-------------------------------------------------------------------------------------- \subsection{\texttt{ticks}} @@ -3856,44 +4124,6 @@ Single ticks can be set with the two macros \psyTick[linecolor=blue](1.7){$y_0$} \end{psgraph} \end{LTXexample} - -%-------------------------------------------------------------------------------------- -\subsection{\texttt{labels}} -%-------------------------------------------------------------------------------------- -Syntax: -\begin{lstlisting}[style=syntax] -labels=all|x|y|none -\end{lstlisting} - -This option is also already in the \verb+pst-plot+ package and only mentioned here for -some completness. - -\begin{LTXexample}[width=3.5cm] -\psset{ticksize=6pt} -\begin{pspicture}(-1,-1)(2,2) -\psaxes[labels=all,subticks=5]{->}(0,0)(-1,-1)(2,2) -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}(-1,-1)(2,2) -\psaxes[labels=y,subticks=5]{->}(0,0)(-1,-1)(2,2) -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}(-1,-1)(2,2) -\psaxes[labels=x,subticks=5]{->}(0,0)(2,2)(-1,-1) -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}(-1,-1)(2,2) -\psaxes[labels=none,subticks=5]{->}(0,0)(2,2)(-1,-1) -\end{pspicture} -\end{LTXexample} - - %-------------------------------------------------------------------------------------- \subsection{\texttt{ticksize}, \texttt{xticksize}, \texttt{yticksize}} %-------------------------------------------------------------------------------------- @@ -3918,25 +4148,27 @@ are set from positive to negative values. \medskip \begin{LTXexample}[width=6cm] -\psset{arrowscale=3} +\psset{arrowscale=2} \begin{pspicture}(-1.5,-1.5)(4,3.5) \psaxes[ticksize=0.5cm]{->}(0,0)(-1.5,-1.5)(4,3.5) \end{pspicture} \end{LTXexample} \begin{LTXexample}[width=6cm] -\psset{arrowscale=3} +\psset{arrowscale=2} \begin{pspicture}(-1.5,-1.5)(4,3.5) - \psaxes[xticksize=-10pt 0,yticksize=0 10pt]{->}(0,0)(-1.5,-1.5)(4,3.5) + \psaxes[xticksize=-10pt 0,yticksize=0 10pt]% + {->}(0,0)(-1.5,-1.5)(4,3.5) \end{pspicture} \end{LTXexample} A grid is also possible by setting the values to the max/min coordinates. \begin{LTXexample}[width=6cm] -\psset{arrowscale=3} +\psset{arrowscale=2} \begin{pspicture}(-.5,-.5)(5,4.5) - \psaxes[ticklinestyle=dashed,ticksize=0 4cm]{->}(0,0)(-.5,-.5)(5,4.5) + \psaxes[ticklinestyle=dashed, + ticksize=0 4cm]{->}(0,0)(-.5,-.5)(5,4.5) \end{pspicture} \end{LTXexample} @@ -4000,7 +4232,6 @@ can have any number. 1 sets it to the same length as the main ticks. \end{pspicture} \end{LTXexample} -\clearpage %-------------------------------------------------------------------------------------- \subsection{\texttt{tickcolor}, \texttt{subtickcolor}} @@ -4019,19 +4250,15 @@ ysubtickcolor=<color> \begin{LTXexample}[preset=\centering,pos=t] \begin{pspicture}(0,-0.75)(10,1) -\psaxes[labelsep=2pt,yAxis=false,labelFontSize=\footnotesize,% - labelsep=-10pt,ticksize=0 10mm,subticks=10,subticksize=0.75,% - tickcolor=red,subtickcolor=blue,tickwidth=1pt,% - subtickwidth=0.5pt](10.01,0) +\psaxes[yAxis=false,labelFontSize=\footnotesize,ticksize=0 10mm,subticks=10,subticksize=0.75, + tickcolor=red,subtickcolor=blue,tickwidth=1pt,subtickwidth=0.5pt](10.01,0) \end{pspicture} \end{LTXexample} \begin{LTXexample}[width=5cm] \begin{pspicture}(5,-0.75)(10,1) -\psaxes[labelsep=2pt,yAxis=false,labelFontSize=\footnotesize,% - labelsep=5pt,ticksize=0 -10mm,subticks=10,subticksize=0.75,% - tickcolor=red,subtickcolor=blue,tickwidth=1pt,% - subtickwidth=0.5pt,Ox=5](5,0)(5,0)(10.01,0) +\psaxes[yAxis=false,labelFontSize=\footnotesize,ticksize=0 -10mm,subticks=10,subticksize=0.75, + tickcolor=red,subtickcolor=blue,tickwidth=1pt,subtickwidth=0.5pt,Ox=5](5,0)(5,0)(10.01,0) \end{pspicture} \end{LTXexample} @@ -4056,10 +4283,9 @@ value \verb+none+ doesn't really makes sense, because it is the same to \begin{LTXexample}[preset=\centering,pos=t] \psset{unit=4cm} \pspicture(-0.15,-0.15)(2.5,1) - \psaxes[axesstyle=frame,logLines=y,xticksize=0 1,xsubticksize=1,% - ylogBase=10,tickcolor=red,subtickcolor=blue,tickwidth=1pt,% - subticks=20,xsubticks=10,xticklinestyle=dashed,% - xsubticklinestyle=dashed](2.5,1) + \psaxes[axesstyle=frame,logLines=y,xticksize=0 1,xsubticksize=1,ylogBase=10, + tickcolor=red,subtickcolor=blue,tickwidth=1pt,subticks=20,xsubticks=10, + xticklinestyle=dashed,xsubticklinestyle=dashed](2.5,1) \endpspicture \end{LTXexample} @@ -4082,17 +4308,16 @@ loglines=all|x|y \begin{LTXexample}[preset=\centering,pos=t] \psset{unit=4cm} \pspicture(-0.15,-0.15)(2.5,3) - \psaxes[axesstyle=frame,logLines=y,xticksize=0 3,xsubticksize=1,% - ylogBase=10,tickcolor=red,subtickcolor=blue,tickwidth=1pt,% - subticks=20,xsubticks=10](2.5,3) + \psaxes[axesstyle=frame,logLines=y,xticksize=0 3,xsubticksize=1,ylogBase=10, + tickcolor=red,subtickcolor=blue,tickwidth=1pt,subticks=20,xsubticks=10](2.5,3) \endpspicture \end{LTXexample} \begin{LTXexample}[preset=\centering,pos=t] \psset{unit=4} \pspicture(-0.5,-0.3)(3,1.2) - \psaxes[axesstyle=frame,logLines=x,xlogBase=10,Dy=0.5,% - tickcolor=red,subtickcolor=blue,tickwidth=1pt,ysubticks=5,xsubticks=10](3,1) + \psaxes[axesstyle=frame,logLines=x,xlogBase=10,Dy=0.5,tickcolor=red, + subtickcolor=blue,tickwidth=1pt,ysubticks=5,xsubticks=10](3,1) \endpspicture \end{LTXexample} @@ -4295,63 +4520,63 @@ This is only a demonstration that the default option \verb|logBase={}| still wor \begin{center} -\psset{arrowscale=3} - \psaxes[labelsep=2pt,yAxis=false,subticks=8]{->}(0,0)(-5,-1)(5,1)\\[1cm] - \psaxes[yAxis=false,subticks=4,ticksize=-4pt 0]{->}(0,0)(5,1)(-5,-1)\\ - \psaxes[yAxis=false,subticks=4,ticksize=-10pt 0]{->}(0,0)(-5,-5)(5,5)\\[1cm] - \psaxes[yAxis=false,subticks=10,ticksize=0 -10pt,labelsep=15pt]{->}(0,0)(-5,-5)(5,5)\\[1cm] - \psaxes[yAxis=false,subticks=4,ticksize=0 10pt,labelsep=-15pt]{->}(0,0)(5,5)(-5,-5)\\[1cm] - \psaxes[yAxis=false,subticks=4,ticksize=0 -10pt]{->}(0,0)(5,5)(-5,-5)\\[0.25cm] - \psaxes[yAxis=false,subticks=0]{->}(0,0)(-5,-5)(5,5)\\[1cm] - \psaxes[yAxis=false,subticks=0,tickcolor=red,linecolor=blue]{->}(0,0)(5,5)(-5,-5)\\ - \psaxes[yAxis=false,subticks=5,tickwidth=2pt,subtickwidth=1pt]{->}(0,0)(-5,-5)(5,5)\\[1cm] - \psaxes[yAxis=false,subticks=0,tickcolor=red]{->}(0,0)(5,5)(-5,-5) +{\psset{arrowscale=3,arrows=-D>,yAxis=false} + \psaxes[subticks=8](0,0)(-5,-1)(5,1)\\[1cm] + \psaxes[subticks=4,ticksize=-4pt 0,xlabelPos=top](0,0)(5,1)(-5,-1)\\ + \psaxes[subticks=4,ticksize=-10pt 0](0,0)(-5,-5)(5,5)\\[1cm] + \psaxes[subticks=10,ticksize=0 -10pt](0,0)(-5,-5)(5,5)\\[1cm] + \psaxes[subticks=4,ticksize=0 10pt,xlabelPos=bottom](0,0)(5,5)(-5,-5)\\[1cm] + \psaxes[subticks=4,ticksize=0 -10pt,xlabelPos=top](0,0)(5,5)(-5,-5)\\[0.25cm] + \psaxes[subticks=0](0,0)(-5,-5)(5,5)\\[1cm] + \psaxes[subticks=0,tickcolor=red,linecolor=blue,xlabelPos=top](0,0)(5,5)(-5,-5)\\ + \psaxes[subticks=5,tickwidth=2pt,subtickwidth=1pt](0,0)(-5,-5)(5,5)\\[1cm] + \psaxes[subticks=0,tickcolor=red,xlabelPos=top](0,0)(5,5)(-5,-5)} \end{center} \begin{lstlisting}[xrightmargin=-1.75cm] -\psset{arrowscale=3} -\psaxes[labelsep=2pt,yAxis=false,subticks=8]{->}(0,0)(-5,-1)(5,1)\\[1cm] -\psaxes[yAxis=false,subticks=4,ticksize=-4pt 0]{->}(0,0)(5,1)(-5,-1)\\ -\psaxes[yAxis=false,subticks=4,ticksize=-10pt 0]{->}(0,0)(-5,-5)(5,5)\\[1cm] -\psaxes[yAxis=false,subticks=10,ticksize=0 -10pt,labelsep=15pt]{->}(0,0)(-5,-5)(5,5)\\[1cm] -\psaxes[yAxis=false,subticks=4,ticksize=0 10pt,labelsep=-15pt]{->}(0,0)(5,5)(-5,-5)\\[1cm] -\psaxes[yAxis=false,subticks=4,ticksize=0 -10pt]{->}(0,0)(5,5)(-5,-5)\\[0.25cm] -\psaxes[yAxis=false,subticks=0]{->}(0,0)(-5,-5)(5,5)\\[1cm] -\psaxes[yAxis=false,subticks=0,tickcolor=red,linecolor=blue]{->}(0,0)(5,5)(-5,-5)\\ -\psaxes[yAxis=false,subticks=5,tickwidth=2pt,subtickwidth=1pt]{->}(0,0)(-5,-5)(5,5)\\[1cm] -\psaxes[yAxis=false,subticks=0,tickcolor=red]{->}(0,0)(5,5)(-5,-5) +\psset{arrowscale=3,arrows=-D>,yAxis=false} + \psaxes[subticks=8](0,0)(-5,-1)(5,1)\\[1cm] + \psaxes[subticks=4,ticksize=-4pt 0,xlabelPos=top](0,0)(5,1)(-5,-1)\\ + \psaxes[subticks=4,ticksize=-10pt 0](0,0)(-5,-5)(5,5)\\[1cm] + \psaxes[subticks=10,ticksize=0 -10pt](0,0)(-5,-5)(5,5)\\[1cm] + \psaxes[subticks=4,ticksize=0 10pt,xlabelPos=bottom](0,0)(5,5)(-5,-5)\\[1cm] + \psaxes[subticks=4,ticksize=0 -10pt,xlabelPos=top](0,0)(5,5)(-5,-5)\\[0.25cm] + \psaxes[subticks=0](0,0)(-5,-5)(5,5)\\[1cm] + \psaxes[subticks=0,tickcolor=red,linecolor=blue,xlabelPos=top](0,0)(5,5)(-5,-5)\\ + \psaxes[subticks=5,tickwidth=2pt,subtickwidth=1pt](0,0)(-5,-5)(5,5)\\[1cm] + \psaxes[subticks=0,tickcolor=red,xlabelPos=top](0,0)(5,5)(-5,-5)} \end{lstlisting} \clearpage \vspace*{4cm} \begin{center} - \psset{arrowscale=3} - \psaxes[xAxis=false,subticks=8]{->}(0,0)(-5,-5)(5,5)\hspace{2em} - \psaxes[xAxis=false,subticks=4]{->}(0,0)(5,5)(-5,-5)\hspace{4em} - \psaxes[xAxis=false,subticks=4,ticksize=0 4pt]{->}(0,0)(-5,-5)(5,5)\hspace{3em} - \psaxes[xAxis=false,subticks=4,ticksize=-4pt 0]{->}(0,0)(-5,-5)(5,5)\hspace{1em} - \psaxes[xAxis=false,subticks=4,ticksize=0 4pt]{->}(0,0)(5,5)(-5,-5)\hspace{2em} - \psaxes[xAxis=false,subticks=4,ticksize=-4pt 0,linecolor=red]{->}(0,0)(5,5)(-5,-5)\hspace{4em} - \psaxes[xAxis=false,subticks=0]{->}(0,0)(-5,-5)(5,5)\hspace{1em} - \psaxes[xAxis=false,subticks=0,tickcolor=red,linecolor=blue]{->}(0,0)(5,5)(-5,-5)\hspace{4em} - \psaxes[xAxis=false,subticks=5,tickwidth=2pt,subtickwidth=1pt]{->}(0,0)(-5,-5)(5,5)\hspace{2em} - \psaxes[xAxis=false,subticks=5,tickcolor=red,tickwidth=2pt,% - ticksize=10pt,subtickcolor=blue,subticksize=0.75]{->}(0,0)(5,5)(-5,-5) +\psset{arrowscale=3,xAxis=false} +\psaxes[subticks=8]{->}(0,0)(-5,-5)(5,5)\hspace{2em} +\psaxes[subticks=4,ylabelPos=right,ylabelPos=left]{->}(0,0)(5,5)(-5,-5)\hspace{4em} +\psaxes[subticks=4,ticksize=0 4pt]{->}(0,0)(-5,-5)(5,5)\hspace{3em} +\psaxes[subticks=4,ticksize=-4pt 0]{->}(0,0)(-5,-5)(5,5)\hspace{1em} +\psaxes[subticks=4,ticksize=0 4pt,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{3em} +\psaxes[subticks=4,ticksize=-4pt 0,linecolor=red,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{5em} +\psaxes[subticks=0]{->}(0,0)(-5,-5)(5,5)\hspace{1em} +\psaxes[subticks=0,tickcolor=red,linecolor=blue,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{5em} +\psaxes[subticks=5,tickwidth=2pt,subtickwidth=1pt]{->}(0,0)(-5,-5)(5,5)\hspace{1em} +\psaxes[subticks=5,tickcolor=red,tickwidth=2pt,% + ticksize=10pt,subtickcolor=blue,subticksize=0.75,ylabelPos=right]{->}(0,0)(5,5)(-5,-5) \end{center} \vspace*{5cm} \begin{lstlisting}[xrightmargin=-1.75cm] -\psset{arrowscale=3} -\psaxes[xAxis=false,subticks=8]{->}(0,0)(-5,-5)(5,5)\hspace{2em} -\psaxes[xAxis=false,subticks=4]{->}(0,0)(5,5)(-5,-5)\hspace{4em} -\psaxes[xAxis=false,subticks=4,ticksize=0 4pt]{->}(0,0)(-5,-5)(5,5)\hspace{3em} -\psaxes[xAxis=false,subticks=4,ticksize=-4pt 0]{->}(0,0)(-5,-5)(5,5)\hspace{1em} -\psaxes[xAxis=false,subticks=4,ticksize=0 4pt]{->}(0,0)(5,5)(-5,-5)\hspace{2em} -\psaxes[xAxis=false,subticks=4,ticksize=-4pt 0,linecolor=red]{->}(0,0)(5,5)(-5,-5)\hspace{4em} -\psaxes[xAxis=false,subticks=0]{->}(0,0)(-5,-5)(5,5)\hspace{1em} -\psaxes[xAxis=false,subticks=0,tickcolor=red,linecolor=blue]{->}(0,0)(5,5)(-5,-5)\hspace{4em} -\psaxes[xAxis=false,subticks=5,tickwidth=2pt,subtickwidth=1pt]{->}(0,0)(-5,-5)(5,5)\hspace{2em} -\psaxes[xAxis=false,subticks=5,tickcolor=red,tickwidth=2pt,% - ticksize=10pt,subtickcolor=blue,subticksize=0.75]{->}(0,0)(5,5)(-5,-5) +\psset{arrowscale=3,xAxis=false} +\psaxes[subticks=8]{->}(0,0)(-5,-5)(5,5)\hspace{2em} +\psaxes[subticks=4,ylabelPos=right,ylabelPos=left]{->}(0,0)(5,5)(-5,-5)\hspace{4em} +\psaxes[subticks=4,ticksize=0 4pt]{->}(0,0)(-5,-5)(5,5)\hspace{3em} +\psaxes[subticks=4,ticksize=-4pt 0]{->}(0,0)(-5,-5)(5,5)\hspace{1em} +\psaxes[subticks=4,ticksize=0 4pt,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{3em} +\psaxes[subticks=4,ticksize=-4pt 0,linecolor=red,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{5em} +\psaxes[subticks=0]{->}(0,0)(-5,-5)(5,5)\hspace{1em} +\psaxes[subticks=0,tickcolor=red,linecolor=blue,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{5em} +\psaxes[subticks=5,tickwidth=2pt,subtickwidth=1pt]{->}(0,0)(-5,-5)(5,5)\hspace{1em} +\psaxes[subticks=5,tickcolor=red,tickwidth=2pt,% + ticksize=10pt,subtickcolor=blue,subticksize=0.75,ylabelPos=right]{->}(0,0)(5,5)(-5,-5) \end{lstlisting} \begin{LTXexample}[width=5.5cm] @@ -4429,28 +4654,222 @@ This is only a demonstration that the default option \verb|logBase={}| still wor \begin{LTXexample}[width=3.5cm] \pspicture(0,1)(-3,-4) \psaxes[axesstyle=axes,subticks=5,% - ticksize=0 10pt,labelsep=13pt](-3,-4) + ticksize=0 10pt](-3,-4) \endpspicture \end{LTXexample} +\clearpage %-------------------------------------------------------------------------------------- -\subsection{\texttt{xlabelFactor} and \texttt{ylabelFactor}} +\subsection[\texttt{algebraic}]{\texttt{algebraic}%\footnote{This part is adapted +% from the package \texttt{pst-eqdf}, written by Dominique Rodriguez.} +} %-------------------------------------------------------------------------------------- -When having big numbers as data records then it makes sense to write the values -as ${<number>\cdot 10^{<exp>}}$. These new options allow to define the additional part -of the value, but it must be set in math mode when using math operators! +By default the function of \verb+\psplot+ has to be described in Reversed Polish Notation. +The option \verb+algebraic+ allows to do this in the common algebraic notation. E.g.: + +\begin{tabular}{l|l} +RPN & algebraic\\\hline +\verb+x ln+ & \verb+ln(x)+\\ +\verb+x cos 2.71 x neg 10 div exp mul+ & \verb+cos(x)*2.71^(-x/10)+\\ +\verb+1 x div cos 4 mul+ & \verb+4*cos(1/x)+\\ +\verb+t cos t sin+ & \verb+cos(t)|sin(t)+ +\end{tabular} + +Setting the option \verb$algebraic$ to \verb$true$, allow the user to describe all +expression to be written in the classical algebraic notation (infix notation). The four arithmetic +operarions are obviously defined \verb$+-*/$, and also the exponential operator +\verb$^$. The natural priorities are used : $3+4\times 5^5=3+(4\times (5^5))$, and by default +the computation is done from left to right. The following functions are defined : + +\medskip +\begin{tabular}{ll} +\verb$sin$, \verb$cos$, \verb$tan$, \verb$acos$, \verb$asin$ & in radians\\ +\verb$log$, \verb$ln$\\ +\verb$ceiling$, \verb$floor$, \verb$truncate$, \verb$round$\\ +\verb$sqrt$ & square root\\ +\verb$abs$ & absolute value\\ +\verb$fact$ & for the factorial\\ +\verb$Sum$ & for building sums\\ +\verb$IfTE$ & for an easy case structure +\end{tabular} + +\medskip +These options can be used with \textbf{all} plot macros. + +{\bfseries Using the option \verb+algebraic+ implies that all angles have to be used in the +radian unit! } + +For the \verb+\parametricplot+ the two parts must be divided by the \verb+|+ character: + +\begin{LTXexample}[width=2cm] +\begin{pspicture}(-0.5,-0.5)(0.5,0.5) +\parametricplot[algebraic,linecolor=red]{-3.14}{3.14}{cos(t)|sin(t)} +\end{pspicture} +\end{LTXexample} \resetOptions -\begin{LTXexample} -\readdata{\data}{demo1.dat} -\pstScalePoints(1,0.000001){}{}% (x,y){additional x operator}{y op} -\psset{llx=-1cm,lly=-1cm} -\psgraph[ylabelFactor=\cdot 10^6,Dx=5,Dy=100](0,0)(25,750){8cm}{5cm} - \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} +\bigskip +%\begin{LTXexample}[pos=t] +\psset{lly=-0.5cm} +\psgraph[trigLabels,dx=\psPi,dy=0.5,Dy=0.5]{->}(0,0)(-10,-1)(10,1){\linewidth}{6cm} + \psset{algebraic,plotpoints=1000} + \psplot[linecolor=yellow,linewidth=2pt]{-10}{10}{0.75*sin(x)*cos(x/2)}% + \psplot[linecolor=red,showpoints=true,plotpoints=101]{-10}{10}{0.75*sin(x)*cos(x/2)} \endpsgraph -\pstScalePoints(1,1){}{}% reset -\end{LTXexample} +%\end{LTXexample} + +\bigskip +\begin{lstlisting} +\psset{lly=-0.5cm} +\psgraph[trigLabels,dx=\psPi,dy=0.5,Dy=0.5]{->}(0,0)(-10,-1)(10,1){\linewidth}{6cm} + \psset{algebraic,plotpoints=1000} + \psplot[linecolor=yellow,linewidth=2pt]{-10}{10}{0.75*sin(x)*cos(x/2)}% + \psplot[linecolor=red,showpoints=true,plotpoints=101]{-10}{10}{0.75*sin(x)*cos(x/2)} +\endpsgraph +\end{lstlisting} + + +\bigskip +%\begin{LTXexample}[pos=t] +\bgroup +\psset{lly=-0.5cm} +\psgraph(0,-5)(18,3){15cm}{5cm} + \psset{algebraic,plotpoints=501} + \psplot[linecolor=yellow, linewidth=4\pslinewidth]{0.01}{18}{ln(x)}% + \psplot[linecolor=red]{0.01}{18}{ln(x)} + \psplot[linecolor=yellow,linewidth=4\pslinewidth]{0}{18}{3*cos(x)*2.71^(-x/10)} + \psplot[linecolor=blue,showpoints=true,plotpoints=51]{0}{18}{3*cos(x)*2.71^(-x/10)} +\endpsgraph +\egroup +%\end{LTXexample} + + +\bigskip +\begin{lstlisting} +\psset{lly=-0.5cm} +\psgraph(0,-5)(18,3){15cm}{5cm} + \psset{algebraic,plotpoints=501} + \psplot[linecolor=yellow, linewidth=4\pslinewidth]{0.01}{18}{ln(x)}% + \psplot[linecolor=red]{0.01}{18}{ln(x)} + \psplot[linecolor=yellow,linewidth=4\pslinewidth]{0}{18}{3*cos(x)*2.71^(-x/10)} + \psplot[linecolor=blue,showpoints=true,plotpoints=51]{0}{18}{3*cos(x)*2.71^(-x/10)} +\endpsgraph +\end{lstlisting} + + + +\clearpage +%-------------------------------------------------------------------------------------- +\subsubsection{Using the \texttt{Sum} function} +%-------------------------------------------------------------------------------------- + +Syntax: \verb+Sum(<index name>,<start>,<step>,<end>,<function>)+ + +Let's plot the first development of cosine with polynomials: +$\displaystyle\sum_{n=0}^{+\infty}\frac{(-1)^nx^{2n}}{n!}$. + +\begin{center} +\bgroup +\psset{algebraic, plotpoints=501, yunit=3} +\def\getColor#1{\ifcase#1 black\or red\or magenta\or yellow\or green\or Orange\or blue\or + DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\fi} +\begin{pspicture}(-7,-1.5)(7,1.5) + \psclip{\psframe(-7,-1.5)(7,1.5)} + \psplot{-7}{7}{cos(x)} + \multido{\n=1+1}{10}{% + \psplot[linewidth=1pt,linecolor=\getColor{\n}]{-7}{7}{% + Sum(ijk,0,1,\n,(-1)^ijk*x^(2*ijk)/fact(2*ijk))}} + \endpsclip + \psaxes(0,0)(-7,-1.5)(7,1.5) +\end{pspicture} +\egroup +\end{center} +\begin{lstlisting} +\psset{algebraic, plotpoints=501, yunit=3} +\def\getColor#1{\ifcase#1 black\or red\or magenta\or yellow\or green\or Orange\or blue\or + DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\fi} +\begin{pspicture}(-7,-1.5)(7,1.5) + \psclip{\psframe(-7,-1.5)(7,1.5)} + \psplot{-7}{7}{cos(x)} + \multido{\n=1+1}{10}{% + \psplot[linewidth=1pt,linecolor=\getColor{\n}]{-7}{7}{% + Sum(ijk,0,1,\n,(-1)^ijk*x^(2*ijk)/fact(2*ijk))}} + \endpsclip + \psaxes(0,0)(-7,-1.5)(7,1.5) +\end{pspicture} +\end{lstlisting} + +\clearpage +%-------------------------------------------------------------------------------------- +\subsubsection{Using the \texttt{IfTE} function} +%-------------------------------------------------------------------------------------- +Syntax: \verb+IfTE(<condition>,<true part>,<false part>)+ + +Nesting of several \verb+IfTE+ are possible and seen in the following examples. +A classical example is a piece wise linear function. + +\begin{center} +\begin{pspicture}(-7.5,-2.5)(7.5,6) + \psaxes{->}(0,0)(-7,-2)(7.5,6)[x,-90][y,0] + \psset{algebraic=true, plotpoints=21,linewidth=2pt} + \psplot[linecolor=blue]{-7.5}{7.5}{IfTE(x<-6,8+x,IfTE(x<0,-x/3,IfTE(x<3,2*x,9-x)))} + \psplot[linecolor=red, plotpoints=101]{-7.5}{7.5}{% + IfTE(2*x<-2^2*sqrt(9),7+x,IfTE(x<0,x^2/18-1,IfTE(x<3,2*x^2/3-1,8-x)))}% +\end{pspicture} +\end{center} + + +\begin{lstlisting} +\begin{pspicture}(-7.5,-2.5)(7.5,6) + \psaxes{->}(0,0)(-7,-2)(7.5,6)[x,-90][y,0] + \psset{algebraic=true, plotpoints=21,linewidth=2pt} + \psplot[linecolor=blue]{-7.5}{7.5}{IfTE(x<-6,8+x,IfTE(x<0,-x/3,IfTE(x<3,2*x,9-x)))} + \psplot[linecolor=red, plotpoints=101]{-7.5}{7.5}{% + IfTE(2*x<-2^2*sqrt(9),7+x,IfTE(x<0,x^2/18-1,IfTE(x<3,2*x^2/3-1,8-x)))}% +\end{pspicture} +\end{lstlisting} + +When you program a piece-wise defined function you must take care that a +plotting point must be put on each point where the description changes. Use \verb+showpoints=true+ to +see what's going on, when there is a problem. You are on the save side, when you choose a +big number for \verb+plotpoints+. + +\clearpage + + +\begin{center} +\begin{pspicture}(-8,-8)(8,8) + \psaxes{->}(0,0)(-8,-8)(8,8)[x,-90][y,0] + \psset{plotpoints=1000,linewidth=1pt} + \psplot[algebraic]{-8}{8}{ceiling(x)} + \psplot[algebraic, linecolor=yellow]{-8}{8}{rand/(2^31-1)+x} + \psplot[algebraic, linecolor=red]{-8}{8}{floor(x)} + \psplot[algebraic, linecolor=blue]{-8}{8}{round(x)} + \psplot[algebraic, linecolor=green]{-8}{8}{truncate(x)} + \psplot[algebraic, linecolor=cyan]{-8}{8}{div(mul(4,x),7)} + \psplot[algebraic, linecolor=gray]{-8}{8}{abs(x)+abs(x-3)-abs(5-5*x/7)} + \psplot[algebraic, linecolor=gray]{-8}{8}{abs(3*cos(x)+1)} + \psplot[algebraic, linecolor=magenta]{-8}{8}{floor(8*cos(x))} +\end{pspicture} +\end{center} + +\begin{lstlisting} +\begin{pspicture}(-8,-8)(8,8) + \psaxes{->}(0,0)(-8,-8)(8,8)[x,-90][y,0] + \psset{plotpoints=1000,linewidth=1pt} + \psplot[algebraic, linecolor=yellow]{-8}{8}{rand/(2^31-1)+x} + \psplot[algebraic]{-8}{8}{ceiling(x)} + \psplot[algebraic, linecolor=red]{-8}{8}{floor(x)} + \psplot[algebraic, linecolor=blue]{-8}{8}{round(x)} + \psplot[algebraic, linecolor=green]{-8}{8}{truncate(x)} + \psplot[algebraic, linecolor=cyan]{-8}{8}{div(mul(4,x),7)} + \psplot[algebraic, linecolor=gray]{-8}{8}{abs(x)+abs(x-3)-abs(5-5*x/7)} + \psplot[algebraic, linecolor=gray]{-8}{8}{abs(3*cos(x)+1)} + \psplot[algebraic, linecolor=magenta]{-8}{8}{floor(8*cos(x))} +\end{pspicture} +\end{lstlisting} + %-------------------------------------------------------------------------------------- \subsection{Plot style \texttt{bar} and option \texttt{barwidth}} @@ -4525,343 +4944,6 @@ value of \verb+0.25cm+, which is the total width. \end{pspicture} \end{LTXexample} -%-------------------------------------------------------------------------------------- -\subsection{\texttt{trigLabels} and \texttt{trigLabelBase} -- axis with trigonmetrical units} -%-------------------------------------------------------------------------------------- -With the option \verb+trigLabels=true+ the labels on the x axis are trigonometrical ones. -The option \verb+trigLabelBase+ set the demoninator of fraction. The default value of -0 is the same as no fraction. -The following constants are are defined in the package: -\begin{lstlisting}[style=syntax] -\def§\ON§\psPiFour§\OFF§{12.566371} -\def§\ON§\psPiTwo§\OFF§{6.283185} -\def§\ON§\psPi§\OFF§{3.14159265} -\def§\ON§\psPiH§\OFF§{1.570796327} -\newdimen\pstRadUnit -\newdimen\pstRadUnitInv -§\ON§\pstRadUnit§\OFF§=1.047198cm % this is pi/3 -§\ON§\pstRadUnitInv§\OFF§=0.95493cm % this is 3/pi -\end{lstlisting} - - - -Because it is a bit complicating to set the right values, we show some more examples -here. - -For \textbf{all} following examples in this section we did a -global\\ \lstinline[frame=single]|\psset{trigLabels=true,labelFontSize=\small}|. - - - -\psset{trigLabels,labelFontSize=\small} -Translating the decimal ticks to geometrical makes no real sense, -because every 1 xunit (1cm) is a tick and the last one at 6cm. - -\begin{minipage}{0.4\fullWidth} -\begin{pspicture}[trigLabels=true](-0.5,-1.25)(6.5,1.25)% - \pnode(5,0){A}% - \psaxes{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25)% -\end{pspicture} -\end{minipage}% -\begin{minipage}{0.6\fullWidth} -\begin{lstlisting} -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)% - \pnode(5,0){A}% - \psaxes{->}(0,0)(-.5,-1.25)(\psPiTwo,1.25) -\end{pspicture} -\end{lstlisting} -\end{minipage} - -\begin{minipage}{0.4\fullWidth} -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)% - \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) -\end{pspicture} -\end{minipage}% -\begin{minipage}{0.6\fullWidth} -\begin{lstlisting} -\begin{pspicture}(-0.5,-1.25)(10,1.25)% - \psaxes[§\ON§trigLabelBase=3§\OFF§]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) -\end{pspicture} -\end{lstlisting} -\end{minipage} - - - -Modifing the ticks to have the last one exactly at the end is possible -with a different dx value ($\frac{\pi}{3}\approx 1.047$): - - -\begin{minipage}{0.4\fullWidth} -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(\psPiTwo,0){C}% - \psaxes[dx=\pstRadUnit]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) -\end{pspicture}% -\end{minipage}% -\begin{minipage}{0.6\fullWidth} -\begin{lstlisting} -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(\psPiTwo,0){C}% - \psaxes[§\ON§dx=\pstRadUnit§\OFF§]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) -\end{pspicture}% -\end{lstlisting} -\end{minipage} - - -\begin{minipage}{0.4\fullWidth} -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(5,0){B}% - \psaxes[dx=\pstRadUnit,trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) -\end{pspicture}% -\end{minipage}% -\begin{minipage}{0.6\fullWidth} -\begin{lstlisting} -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(5,0){B}% - \psaxes[dx=\pstRadUnit,§\ON§trigLabelBase=3§\OFF§] {->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) -\end{pspicture}% -\end{lstlisting} -\end{minipage} - -\ncline[linestyle=dashed,linewidth=0.4pt]{A}{B} - -Set globaly everything in radiant unit. Now 6 units on the $x$-axis -are $6\pi$. Using \verb+trigLabelBase=3+ reduces this value to $2\pi$, a.s.o. - -\bigskip -\begin{minipage}{0.4\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(6,0){D}% - \psaxes{->}(0,0)(-0.5,-1.25)(6.5,1.25)% -\end{pspicture}% -\end{minipage}% -\begin{minipage}{0.6\fullWidth} -\begin{lstlisting} -\psset{§\ON§xunit=\pstRadUnit§\OFF§}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(6,0){D}% - \psaxes{->}(0,0)(-0.5,-1.25)(6.5,1.25)% -\end{pspicture}% -\end{lstlisting} -\end{minipage} -\ncline[linestyle=dashed,linewidth=0.4pt]{C}{D} - - -\begin{minipage}{0.4\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) -\end{pspicture}% -\end{minipage}% -\begin{minipage}{0.6\fullWidth} -\begin{lstlisting} -\psset{§\ON§xunit=\pstRadUnit§\OFF§}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[§\ON§trigLabelBase=3§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) -\end{pspicture}% -\end{lstlisting} -\end{minipage} - - - -\begin{minipage}{0.4\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=4]{->}(0,0)(-0.5,-1.25)(6.5,1.25) -\end{pspicture}% -\end{minipage}% -\begin{minipage}{0.6\fullWidth} -\begin{lstlisting} -\psset{§\ON§xunit=\pstRadUnit§\OFF§}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[§\ON§trigLabelBase=4§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) -\end{pspicture}% -\end{lstlisting} -\end{minipage} - -\begin{minipage}{0.4\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=6]{->}(0,0)(-0.5,-1.25)(6.5,1.25) -\end{pspicture}% -\end{minipage}% -\begin{minipage}{0.6\fullWidth} -\begin{lstlisting} -\psset{§\ON§xunit=\pstRadUnit§\OFF§}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[§\ON§trigLabelBase=6§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) -\end{pspicture}% -\end{lstlisting} -\end{minipage} - - - -The best way seems to be setting the $x$-unit to \verb+\pstRadUnit+. Plotting a -function doesn't consider the value for \verb+trigLabelBase+, it has to be done by -the user. The first example sets the unit locally for the \verb+\psplot+ -back to 1cm, which is needed, because we use this unit on PostScript side. - -\begin{minipage}{0.4\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[xunit=1cm,linecolor=red,linewidth=1.5pt]{0}{\psPiTwo}{x RadtoDeg sin} -\end{pspicture} -\end{minipage}% -\begin{minipage}{0.6\fullWidth} -\begin{lstlisting} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[§\ON§xunit=1cm§\OFF§,linecolor=red,linewidth=1.5pt]{0}{§\ON§\psPiTwo§\OFF§}{x RadtoDeg sin} -\end{pspicture} -\end{lstlisting} -\end{minipage} - - -\begin{minipage}{0.4\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[linecolor=red,linewidth=1.5pt]{0}{6}{x Pi 3 div mul RadtoDeg sin} -\end{pspicture} -\end{minipage}% -\begin{minipage}{0.6\fullWidth} -\begin{lstlisting} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[linecolor=red,linewidth=1.5pt]{0}{6}{x §\ON§Pi 3 div mul §\OFF§RadtoDeg sin} -\end{pspicture} -\end{lstlisting} -\end{minipage} - - -\begin{minipage}{0.4\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[dx=1.5]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[xunit=.5cm,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin} -\end{pspicture} -\end{minipage}% -\begin{minipage}{0.6\fullWidth} -\begin{lstlisting} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[§\ON§dx=1.5§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[§\ON§xunit=0.5cm§\OFF§,linecolor=red,linewidth=1.5pt]{0}{§\ON§\psPiFour§\OFF§}{x RadtoDeg sin} -\end{pspicture} -\end{lstlisting} -\end{minipage} - - -\begin{minipage}{0.4\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[dx=0.75,trigLabelBase=2]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[xunit=.5cm,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin} -\end{pspicture} -\end{minipage}% -\begin{minipage}{0.6\fullWidth} -\begin{lstlisting} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[§\ON§dx=0.75§\OFF§,§\ON§trigLabelBase=2§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[§\ON§xunit=0.5cm§\OFF§,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin} -\end{pspicture} -\end{lstlisting} -\end{minipage} - - -It is also possible to set the $x$ unit and $dx$ value to get the labels -right. But this needs some more understanding how it really works. -A \verb+xunit=1.570796327+ sets the unit to $\pi/2$ and a \verb+dx=0.666667+ -then puts every $2/3$ of the unit a tick mark and a label. The length of -the $x$-axis is 6.4 units which is $6.4\cdot 1.570796327cm\approx 10cm$. -The function then is plotted from $0$ to $3\pi=9.424777961$. - - - - -\begin{center} -\psset{unit=1cm} -\begin{pspicture}(-0.5,-1.25)(10,1.25) - \psaxes[xunit=1.570796327,showorigin=false,trigLabelBase=3,dx=0.666667]{->}(0,0)(-0.5,-1.25)(6.4,1.25) - \psplot[linecolor=red,linewidth=1.5pt]{0}{9.424777961}{% - x RadtoDeg dup sin exch 1.1 mul cos add} -\end{pspicture} -\end{center} -\begin{lstlisting} -\begin{pspicture}(-0.5,-1.25)(10,1.25) - \psaxes[§\ON§xunit=1.570796327§\OFF§,§\ON§trigLabelBase=3§\OFF§,§\ON§dx=0.666667§\OFF§]{->}(0,0)(-0.5,-1.25)(6.4,1.25) - \psplot[linecolor=red,linewidth=1.5pt]{0}{§\ON§9.424777961§\OFF§}{% - x RadtoDeg dup sin exch 1.1 mul cos add} -\end{pspicture} -\end{lstlisting} - -\begin{center} -\psset{unit=1cm} -\begin{pspicture}(-0.5,-1.25)(10,1.25) - \psaxes[xunit=\psPi,dx=0.25]{->}(0,0)(-0.25,-1.25)(3.2,1.25) - \psplot[xunit=0.25,plotpoints=500,linecolor=red,linewidth=1.5pt]{0}{37.70}{% - x RadtoDeg dup sin exch 1.1 mul cos add} -\end{pspicture} -\end{center} -\begin{lstlisting} -\psset{§\ON§unit=1cm§\OFF§} - \psplot[§\ON§xunit=0.25§\OFF§,§\ON§plotpoints=500§\OFF§,linecolor=red,linewidth=1.5pt]{0}{37.70}{% - x RadtoDeg dup sin exch 1.1 mul cos add} -\end{pspicture} -\end{lstlisting} - - -\begin{center} -\psset{unit=1cm} -\begin{pspicture}(-0.5,-2)(10,2) - \psplot[xunit=0.0625,linecolor=red,linewidth=1.5pt,plotpoints=5000]{0}{150.80}{% - x RadtoDeg dup sin exch 1.1 mul cos add} - \psaxes[xunit=\psPi,dx=0.5,Dx=8,subticks=2]{->}(0,0)(-0.1,-2)(3.2,2) -\end{pspicture} -\end{center} -\begin{lstlisting} -\psset{§\ON§unit=1cm§\OFF§} -\begin{pspicture}(-0.5,-1.25)(10,1.25) - \psplot[§\ON§xunit=0.0625§\OFF§,linecolor=red,linewidth=1.5pt,% - §\ON§plotpoints=5000§\OFF§]{0}{150.80}% - {x RadtoDeg dup sin exch 1.1 mul cos add} - \psaxes[§\ON§xunit=\psPi§\OFF§,§\ON§dx=0.5§\OFF§,§\ON§Dx=8§\OFF§]{->}(0,0)(-0.25,-1.25)(3.2,1.25) -\end{pspicture} -\end{lstlisting} - - -\begin{center} -\psset{unit=1cm} -\begin{pspicture}(-7,-1.5)(7,1.5) - \psaxes[trigLabels=true,xunit=\psPi]{->}(0,0)(-2.2,-1.5)(2.2,1.5) - \psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin} -\end{pspicture} -\end{center} -\begin{lstlisting} -\begin{pspicture}(-7,-1.5)(7,1.5) - \psaxes[trigLabels=true,§\ON§xunit=\psPi§\OFF§]{->}(0,0)(-2.2,-1.5)(2.2,1.5) - \psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin} -\end{pspicture} -\end{lstlisting} - - -\begin{center} -\psset{unit=1cm} -\begin{pspicture}(-7,-1.5)(7,1.5) - \psaxes[trigLabels=true, - trigLabelBase=2,dx=\psPiH,xunit=\psPi]{->}(0,0)(-2.2,-1.5)(2.2,1.5) - \psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin} -\end{pspicture} -\end{center} -\begin{lstlisting} -\begin{pspicture}(-7,-1.5)(7,1.5) - \psaxes[trigLabels=true, - trigLabelBase=2,dx=\psPiH,xunit=\psPi]{->}(0,0)(-2.2,-1.5)(2.2,1.5) - \psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin} -\end{pspicture} -\end{lstlisting} - - -\psset{trigLabels=false} - %------------------------------------------------------------------------------------ @@ -4953,11 +5035,14 @@ both values. The datafile \verb|data.dat| contains $1000$ data records. The thin blue line is the plot of all records with the plotstyle option \verb|curve|. +\resetOptions \begin{LTXexample}[preset=\centering,pos=t] \readdata{\data}{data.dat} -\psset{xunit=0.125mm,yunit=0.0002mm} -\begin{pspicture}(-80,-30000)(1000,270000) -\psaxes[Dx=100,dx=100,Dy=50000,dy=50000](1000,250000) +\psset{xunit=12.5cm,yunit=0.2mm} +\begin{pspicture}(-0.080,-30)(1,270) +\pstScalePoints(1,1){1000 div}{1000 div} +\psaxes[Dx=200,dx=2.5cm,Dy=100, + ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250) \listplot[nStep=50,linewidth=3pt,linecolor=red,plotstyle=dots]{\data} \listplot[linewidth=1pt,linecolor=blue]{\data} \end{pspicture} @@ -4972,10 +5057,14 @@ of all records with the plotstyle option \verb|curve|. \begin{LTXexample}[preset=\centering,pos=t] \readdata{\data}{data.dat} -\psset{xunit=0.125mm,yunit=0.0002mm} -\begin{pspicture}(-80,-30000)(1000,270000) -\psaxes[Dx=100,dx=100,Dy=50000,dy=50000](1000,250000) -\listplot[nStart=200,linewidth=3pt,linecolor=blue]{\data} +\psset{xunit=12.5cm,yunit=0.2mm} +\begin{pspicture}(-0.080,-30)(1,270) +\pstScalePoints(1,1){1000 div}{1000 div} +\psaxes[Dx=200,dx=2.5cm,Dy=100, + ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250) +\listplot[nStart=200,linewidth=3pt, + linecolor=blue,plotstyle=dots]{\data} +\listplot[linewidth=1pt,linecolor=blue]{\data} \end{pspicture} \end{LTXexample} @@ -4986,10 +5075,14 @@ of all records with the plotstyle option \verb|curve|. \begin{LTXexample}[preset=\centering,pos=t] \readdata{\data}{data.dat} -\psset{xunit=0.125mm,yunit=0.0002mm} -\begin{pspicture}(-80,-30000)(1000,310000) -\psaxes[axesstyle=frame,Dx=100,dx=100,Dy=50000,dy=50000](1000,300000) -\listplot[nEnd=800,linewidth=3pt,linecolor=blue]{\data} +\psset{xunit=12.5cm,yunit=0.2mm} +\begin{pspicture}(-0.080,-30)(1,270) +\pstScalePoints(1,1){1000 div}{1000 div} +\psaxes[axesstyle=frame,Dx=200,dx=2.5cm,Dy=100, + ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250) +\listplot[nStart=200,linewidth=3pt, + linecolor=blue]{\data} +\listplot[linewidth=1pt,linecolor=blue]{\data} \end{pspicture} \end{LTXexample} @@ -5002,11 +5095,13 @@ of all records with the plotstyle option \verb|curve|. \begin{LTXexample}[preset=\centering,pos=t] \readdata{\data}{data.dat} -\psset{xunit=0.125mm,yunit=0.0002mm} -\begin{pspicture}(-80,-30000)(1000,310000) -\psaxes[axesstyle=frame,Dx=100,dx=100,Dy=50000,dy=50000](1000,300000) -\listplot[nStart=200, nEnd=800, nStep=50,linewidth=3pt,linecolor=blue,% - plotstyle=dots]{\data} +\psset{xunit=12.5cm,yunit=0.2mm} +\begin{pspicture}(-0.080,-30)(1,270) +\pstScalePoints(1,1){1000 div}{1000 div} +\psaxes[axesstyle=frame,Dx=200,dx=2.5cm,Dy=100, + ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250) +\listplot[nStart=200, nEnd=800, nStep=50, + linewidth=3pt,linecolor=blue,plotstyle=dots]{\data} \end{pspicture} \end{LTXexample} @@ -5074,7 +5169,6 @@ possible to have a kind of a zoom to the original graphic. \end{lstlisting} -\clearpage \resetOptions %-------------------------------------------------------------------------------------- @@ -5083,12 +5177,14 @@ possible to have a kind of a zoom to the original graphic. \begin{LTXexample}[preset=\centering,pos=t] \readdata{\data}{data.dat} -\psset{xunit=0.125mm,yunit=0.0002mm} -\begin{pspicture}(-80,-30000)(1000,310000) - \psaxes[axesstyle=frame,Dx=100,dx=100,Dy=50000,dy=50000](1000,300000) +\psset{xunit=12.5cm,yunit=0.2mm} +\begin{pspicture}(-0.080,-30)(1,270) +\pstScalePoints(1,1){1000 div}{1000 div} +\psaxes[axesstyle=frame,Dx=200,dx=2.5cm,Dy=100, + ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250) \psset{linewidth=0.1pt, linestyle=dashed,linecolor=red} - \psline(0,40000)(1000,40000) - \psline(0,175000)(1000,175000) + \psline(0,40)(1,40) + \psline(0,175)(1,175) \listplot[yStart=40000, yEnd=175000,linewidth=3pt,linecolor=blue,plotstyle=dots]{\data} \end{pspicture} \end{LTXexample} @@ -5308,7 +5404,7 @@ x sin dup mul x cos dup mul add sqrt \resetOptions \psset{plotpoints=200,unit=0.75} \begin{pspicture}*(-5,-5)(3,3) - \psaxes[labelsep=.75mm,arrowlength=1.75,ticksize=2pt,% + \psaxes[arrowlength=1.75,ticksize=2pt,% labelFontSize=\footnotesize,% linewidth=0.17mm]{->}(0,0)(-4.99,-4.99)(3,3) \rput[Br](3,-.35){$x$} @@ -5328,7 +5424,7 @@ x sin dup mul x cos dup mul add sqrt \resetOptions \psset{plotpoints=200,unit=1} \begin{pspicture}(-2.5,-2.5)(2.5,2.5)% Ulrich Dirr - \psaxes[labelsep=.75mm,arrowlength=1.75,% + \psaxes[arrowlength=1.75,% ticksize=2pt,linewidth=0.17mm]{->}(0,0)(-2.5,-2.5)(2.5,2.5) \rput[Br](2.5,-.35){$x$} \rput[tr](-.15,2.5){$y$} @@ -5346,8 +5442,8 @@ x sin dup mul x cos dup mul add sqrt \begin{LTXexample}[width=8cm] \psset{plotpoints=200,unit=0.5} \begin{pspicture}(-8.5,-8.5)(9,9)% Ulrich Dirr -\psaxes[Dx=2,dx=2,Dy=2,dy=2,labelsep=.75mm,% - arrowlength=1.75,ticksize=2pt,linewidth=0.17mm]{->}(0,0)(-8.5,-8.5)(9,9) +\psaxes[Dx=2,dx=2,Dy=2,dy=2,arrowlength=1.75, + ticksize=2pt,linewidth=0.17mm]{->}(0,0)(-8.5,-8.5)(9,9) \rput[Br](9,-.7){$x$} \rput[tr](-.3,9){$y$} \rput[Br](-.3,-.7){$0$} @@ -5401,6 +5497,7 @@ macros. This is the reason why it is a good idea to reset the values at the end \end{lstlisting} +\clearpage %-------------------------------------------------------------------------------------- \part{New commands and environments} %-------------------------------------------------------------------------------------- @@ -5478,8 +5575,8 @@ In the following example, the y unit gets the same value as the one for the x-ax \begin{center} \readdata{\data}{demo1.dat} -\psset{xAxisLabel=x-Axes,yAxisLabel=y-Axes,llx=-.5cm,ury=0.5cm, - xAxisLabelPos={3cm,-1cm},yAxisLabelPos={-1.5cm,2.5cm}} +\psset{xAxisLabel=x-Axis,yAxisLabel=y-Axis,llx=-.5cm,lly=-1cm,lly=-1cm,ury=0.5cm, + xAxisLabelPos={c,-1},yAxisLabelPos={-7,c}} \pstScalePoints(1,0.00000001){}{} \begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1, ylabelFactor=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm} @@ -5489,8 +5586,8 @@ In the following example, the y unit gets the same value as the one for the x-ax \begin{lstlisting} \readdata{\data}{demo1.dat} -\psset{§\ON§xAxisLabel§\OFF§=x-Axes,§\ON§yAxisLabel§\OFF§=y-Axes,llx=-.5cm,ury=0.5cm, - §\ON§xAxisLabelPos§\OFF§={3cm,-1cm},§\ON§yAxisLabelPos§\OFF§={-1.5cm,2.5cm}} +\psset{§\ON§xAxisLabel§\OFF§=x-Axis,§\ON§yAxisLabel§\OFF§=y-Axis,llx=-.5cm,lly=-1cm,ury=0.5cm, + §\ON§xAxisLabelPos§\OFF§={c,-1},§\ON§yAxisLabelPos§\OFF§={-7,c}} \pstScalePoints(1,0.00000001){}{} \begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1, §\ON§ylabelFactor§\OFF§=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm} @@ -5560,7 +5657,7 @@ In the following example, the y unit gets the same value as the one for the x-ax \readdata{\dataII}{demo3.dat}% \pstScalePoints(1,1){1989 sub}{} \psset{llx=-0.5cm,lly=-1cm, xAxisLabel=Year,yAxisLabel=Whatever,% - xAxisLabelPos={2in,-0.4in},yAxisLabelPos={-0.4in,1in}} + xAxisLabelPos={c,-0.4in},yAxisLabelPos={-0.4in,c}} \psgraph[axesstyle=frame,Dx=2,Ox=1989,subticks=2](0,0)(12,6){4in}{2in}% \listplot[linecolor=red,linewidth=2pt]{\data} \listplot[linecolor=blue,linewidth=2pt]{\dataII} @@ -5573,7 +5670,7 @@ In the following example, the y unit gets the same value as the one for the x-ax \readdata{\dataII}{demo3.dat}% \pstScalePoints(1,1){1989 sub}{} \psset{llx=-0.5cm,lly=-1cm, §\ON§xAxisLabel§\OFF§=Year,§\ON§yAxisLabel§\OFF§=Whatever,% - §\ON§xAxisLabelPos§\OFF§={2in,-0.4in},§\ON§yAxisLabelPos§\OFF§={-0.4in,1in}} + §\ON§xAxisLabelPos§\OFF§={c,-0.4in},§\ON§yAxisLabelPos§\OFF§={-0.4in,c}} \psgraph[axesstyle=frame,Dx=2,Ox=1989,subticks=2](0,0)(12,6){4in}{2in}% \listplot[linecolor=red,linewidth=2pt]{\data} \listplot[linecolor=blue,linewidth=2pt]{\dataII} @@ -5636,8 +5733,12 @@ ury & 0pt & trim for the upper right y There is one restriction in using the trim parameters, they must been set \textbf{before} \verb+psgraph+ is called. They are senseless, when using -as parameters of \verb+psgraph+ itself. - +as parameters of \verb+psgraph+ itself. The \verb+?AxisLabelPos+ oprions can use +the letter \verb+c+ for centering an x-axis oder y-axis label. The c is a +replacement for the x or y value. When using values with unit, the position +is always measured fromn the orogin of the coordinate system, which can be +outside of the visible \verb+pspicture+ environment + \medskip \resetOptions @@ -5645,8 +5746,8 @@ as parameters of \verb+psgraph+ itself. \readdata{\data}{demo2.dat}% \readdata{\dataII}{demo3.dat}% \psset{llx=-1cm,lly=-1.25cm,urx=0.5cm,ury=0.1in,xAxisLabel=Year,% - yAxisLabel=Whatever,xAxisLabelPos={.4\linewidth,-0.4in},% - yAxisLabelPos={-0.4in,2in}} + yAxisLabel=Whatever,xAxisLabelPos={c,-0.4in},% + yAxisLabelPos={-0.4in,c}} \pstScalePoints(1,1){1989 sub}{} \psframebox[linestyle=dashed,boxsep=0pt]{% \begin{psgraph}[axesstyle=frame,Ox=1989,subticks=2](0,0)(12,6){0.8\linewidth}{2.5in}% @@ -5662,8 +5763,8 @@ as parameters of \verb+psgraph+ itself. \readdata{\data}{demo2.dat}% \readdata{\dataII}{demo3.dat}% \psset{llx=-1cm,lly=-1.25cm,urx=0.5cm,ury=0.1in,xAxisLabel=Year,% - yAxisLabel=Whatever,xAxisLabelPos={.4\linewidth,-0.4in},% - yAxisLabelPos={-0.4in,2in}} + yAxisLabel=Whatever,xAxisLabelPos={c,-0.4in},% + yAxisLabelPos={-0.4in,c}} \pstScalePoints(1,1){1989 sub}{} \psframebox[linestyle=dashed,boxsep=0pt]{% \begin{psgraph}[axesstyle=frame,Ox=1989,subticks=2](0,0)(12,6){0.8\linewidth}{2.5in}% @@ -6102,6 +6203,7 @@ means that the step is constant for a second order polynomials. \end{lstlisting} +\clearpage \subsection{The neperian Logarithm} A really classical example wich gives a bad beginning, the tolerance is set to $0.001$. @@ -7342,6 +7444,8 @@ The Stella model representing the Lotka-Volterra model will be slightly more com \end{pspicture} \end{lstlisting} + +\clearpage %-------------------------------------------------------------------------------------- \subsubsection{$y''=y$} %-------------------------------------------------------------------------------------- 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 b8520590dcf..b4af4db6b5d 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 24 2008-05-16 18:33:45Z herbert $ +%% $Id: pstricks-add.tex 25 2008-06-06 10:33:45Z herbert $ %% %% %% This is file `pstricks-add.tex', @@ -29,8 +29,8 @@ \ifx\MultidoLoaded\endinput\else \input multido \fi \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi % -\def\fileversion{3.04} -\def\filedate{2008/06/02} +\def\fileversion{3.05} +\def\filedate{2008/06/12} \message{`pstricks-add' v\fileversion, \filedate\space (dr,hv)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax @@ -142,6 +142,13 @@ \global#3=\the\pst@dimm% \endgroup% } +\def\pst@mindim#1#2#3{% + \begingroup% + \pst@dimm=#1\pst@dimn=#2\relax% + \ifdim\pst@dimm>\pst@dimn\pst@dimm=\pst@dimn\fi + \global#3=\the\pst@dimm% + \endgroup% +} \def\pst@abs#1#2{% \begingroup% \pst@cntm=#1\relax% @@ -1029,49 +1036,13 @@ \def\psk@nodeseptypeA{1 }% \def\psk@nodeseptypeB{1 }% } +% % \psGetNodeCenter defines the PS variable #1.x and #1.y, which can then % be used by the user. #1 must be a valid node name -% \def\psGetNodeCenter#1{ tx@NodeDict begin /N@#1 load GetCenter end % x y on stack in system coor \pst@number\psyunit div /#1.y ED % /#1.y in user coor \pst@number\psxunit div /#1.x ED } % /#1.x in user coor % -\pst@def{NCLineII}<{ - NCCoor - /y1 ED /x1 ED x1 y1 ArrowA x1 y1 moveto - /y2 ED /x2 ED - /y0 y1 def /x0 x1 def - /linelength x2 x1 sub y2 y1 sub Pyth def - \psk@dashNo\space 1.0 lt - {/cntMax 1.0 \psk@dashNo\space div .49 add cvi def} - {/cntMax linelength \psk@dashNo\space div .49 add cvi def} ifelse - x2 x1 sub cntMax div /dx ED - y2 y1 sub cntMax div /dy ED - /cnt 0 def - cntMax { - gsave - /x1 x1 dx add def - /y1 y1 dy add def - x1 y1 - cnt 2 mod 0 eq - { \pst@usecolor\psDashColorI } - { \pst@usecolor\psDashColorII } ifelse - lineto stroke - /cnt cnt 1 add def - grestore - x1 y1 moveto - } repeat - x0 y0 x2 y2 ArrowB L pop pop% -}> -% -\def\nclineII{\pst@object{nclineII}}% -\def\nclineII@i{\check@arrow{\nclineII@ii}}% -\def\nclineII@ii#1#2{\nc@object{Open}{#1}{#2}{.5}% - {\tx@NCLineII /LPutPos { xB yB xA yA \tx@LPutLine } def}% -}% -\def\pclineII{\pst@object{pclineII}}% -\def\pclineII@i{\pc@object\nclineII@ii}% -% \define@key[psset]{pstricks-add}{lineAngle}{\psset{armB=0.5}\def\psk@lineAngle{#1}}% %\psset{lineAngle=0}% % @@ -1368,7 +1339,7 @@ \def\pshlabel##1{\psk@labelFontSize##1}% \def\psvlabel##1{\psk@labelFontSize##1} \fi} -\psset{labelFontSize={},mathLabel} +%\psset{labelFontSize={},mathLabel} % \define@boolkey[psset]{pstricks-add}[Pst@]{comma}[true]{} \define@boolkey[psset]{pstricks-add}[Pst@]{xAxis}[true]{} @@ -1377,6 +1348,34 @@ \@nameuse{Pst@xAxis#1}\@nameuse{Pst@yAxis#1}}% %\psset{xyAxes=true}% % +\define@key[psset]{pstricks-add}{xlabelPos}{\pst@expandafter\psset@@xlabelPos{#1}\@nil} +\define@key[psset]{pstricks-add}{ylabelPos}{\pst@expandafter\psset@@ylabelPos{#1}\@nil} +\def\psset@@xlabelPos#1#2\@nil{% + \ifx#1t + \def\psk@xlabelPos{\tw@}% 2=top + \pst@xticksizeC=\pst@xticksizeB% + \else + \ifx#1a + \def\psk@xlabelPos{\@ne}% 1=axis + \pst@xticksizeC=\z@% + \else + \def\psk@xlabelPos{\z@}% 0=bottom + \pst@xticksizeC=\pst@xticksizeA% + \fi\fi}% +\def\psset@@ylabelPos#1#2\@nil{% + \ifx#1r + \def\psk@ylabelPos{\tw@}% 2=right + \pst@yticksizeC=\pst@yticksizeB% + \else + \ifx#1a + \def\psk@ylabelPos{\@ne}% 1=axis + \pst@yticksizeC=\z@% + \else + \def\psk@ylabelPos{\z@}% 0=left + \pst@yticksizeC=\pst@yticksizeA% + \fi\fi} +%\psset{xlabelPos=b, ylabelPos=l}% +% \define@key[psset]{pstricks-add}{xyDecimals}{\def\psk@xDecimals{#1}\def\psk@yDecimals{#1}} \define@key[psset]{pstricks-add}{xDecimals}{\def\psk@xDecimals{#1}} \define@key[psset]{pstricks-add}{yDecimals}{\def\psk@yDecimals{#1}} @@ -1401,27 +1400,54 @@ \pst@mod{\pst@cntm}{\de@nominator}\pst@cntp % cntb=##1 modulo trigLabelBase \ifnum\@ne>\pst@cntp % 1 > modulo -> then we have pi/x \pst@cnto=\pst@cntm \divide\pst@cnto by \de@nominator - \psk@labelFontSize - \ifnum\pst@tempA<0 $-$\fi% - \ifnum\pst@cnto=\@ne % #1 = trigLabelBase - $\pi$ % print pi - \else - $\the\pst@cnto\pi$ % print \pst@cnto/\de@nominator pi - \fi + \ifPst@mathLabel + $\psk@labelFontSize + \ifnum\pst@tempA<0 -\fi% + \ifnum\pst@cnto=\@ne % #1 = trigLabelBase + \pi % print pi + \else + \the\pst@cnto\pi % print \pst@cnto/\de@nominator pi + \fi$ + \else + \psk@labelFontSize + \ifnum\pst@tempA<0 -\fi% + \ifnum\pst@cnto=\@ne % #1 = trigLabelBase + $\pi$ % print pi + \else + \the\pst@cnto$\pi$ % print \pst@cnto/\de@nominator pi + \fi + \fi \else - \psk@labelFontSize - \ifnum\pst@cntp=\@ne % < 1 pi? - \if\pst@cntm=\@ne - $\frac{\pi}{\de@nominator}$ % pi/x - \else\ifnum\pst@tempA=-1 $\frac{-\pi}{\de@nominator}$ - \else \ifnum\pst@tempA=1 $\frac{\pi}{\de@nominator}$ - \else$\frac{\pst@tempA\pi}{\de@nominator}$ % (x pi)/y + \ifPst@mathLabel + $\psk@labelFontSize + \ifnum\pst@cntp=\@ne % < 1 pi? + \if\pst@cntm=\@ne + \frac{\pi}{\de@nominator} % pi/x + \else\ifnum\pst@tempA=-1 \frac{-\pi}{\de@nominator} + \else \ifnum\pst@tempA=1 \frac{\pi}{\de@nominator} + \else\frac{\pst@tempA\pi}{\de@nominator} % (x pi)/y + \fi\fi\fi + \else + \ifnum\pst@tempA=1 \frac{\pi}{\de@nominator} + \else\ifnum\pst@tempA=\de@nominator \pi + \else\frac{\pst@tempA\pi}{\de@nominator} + \fi\fi\fi$ + \else + \psk@labelFontSize + \ifnum\pst@cntp=\@ne % < 1 pi? + \if\pst@cntm=\@ne + $\frac{\pi}{\de@nominator}$ % pi/x + \else\ifnum\pst@tempA=-1 $\frac{-\pi}{\de@nominator}$ + \else \ifnum\pst@tempA=1 $\frac{\pi}{\de@nominator}$ + \else$\frac{\pst@tempA\pi}{\de@nominator}$ % (x pi)/y + \fi\fi\fi + \else + \ifnum\pst@tempA=1 $\frac{\pi}{\de@nominator}$ + \else\ifnum\pst@tempA=\de@nominator $\pi$ + \else$\frac{\pst@tempA\pi}{\de@nominator}$ \fi\fi\fi - \else - \ifnum\pst@tempA=1 $\frac{\pi}{\de@nominator}$ - \else\ifnum\pst@tempA=\de@nominator $\pi$ - \else$\frac{\pst@tempA\pi}{\de@nominator}$ - \fi\fi\fi\fi% + \fi + \fi% }% \else \def\pst@@@hlabel##1{% @@ -1435,7 +1461,7 @@ \fi% } \ifPst@mathLabel - \def\pshlabel##1{\psk@labelFontSize$##1$}\else + \def\pshlabel##1{$\psk@labelFontSize##1$}\else \def\pshlabel##1{\psk@labelFontSize##1}% \fi \fi @@ -1554,11 +1580,6 @@ \let\psk@arrowB\@empty% \psxs@axes% } -%\def\psxs@axes{% -% \psxs@@axes\pst@dima\pst@dimc{}% -% \psxs@@axes\pst@dimb\pst@dimd{exch}% -%} - % \def\psxs@axes{{% \ifPst@xAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{}\fi% @@ -1570,7 +1591,7 @@ \def\psaxes@iii(#1)(#2){\@ifnextchar({\psaxes@iv(#1)(#2)}{\psaxes@iv(#1)(#1)(#2)}} \def\psaxes@iv(#1)(#2)(#3){\@ifnextchar[{\psaxes@v(#1)(#2)(#3)}{\psaxes@vii(#1)(#2)(#3)}}% \def\psaxes@v(#1)(#2)(#3)[#4]{\@ifnextchar[{\psaxes@vi(#1)(#2)(#3)[#4]}{\psaxes@vi(#1)(#2)(#3)[#4][]}}% -\def\psaxes@v(#1)(#2)(#3)[#4,#5][#6,#7]{% +\def\psaxes@vi(#1)(#2)(#3)[#4,#5][#6,#7]{% \psaxes@vii(#1)(#2)(#3)% \uput[#5](#3|0,0){#4}\uput[#7](0,0|#3){#6}% } @@ -1578,12 +1599,16 @@ \def\psaxes@vii(#1,#2)(#3,#4)(#5,#6){% \pst@killglue% \begingroup% + \pssetxlength\pst@dimc{#5}% ur-x + \pssetylength\pst@dimd{#6}% ur-y + \ifdim\pst@dimc<\z@ \ifdim\pst@dimd<\z@ % axes show to left and down + \addbefore@par{xlabelPos=top,ylabelPos=right}\fi\fi \setbox\pst@hbox=\hbox\bgroup% - \use@par% + \use@par% now the same with an optional unit=... in par \pssetxlength\pst@dimg{#1}% o-x \pssetylength\pst@dimh{#2}% o-y - \pssetxlength\pst@dima{#3}% bl-x - \pssetylength\pst@dimb{#4}% bl-y + \pssetxlength\pst@dima{#3}% ll-x + \pssetylength\pst@dimb{#4}% ll-y \pssetxlength\pst@dimc{#5}% ur-x \pssetylength\pst@dimd{#6}% ur-y % If minimum values are negative in log mode, we modify Ox @@ -1591,8 +1616,8 @@ % X axis labels (\psk@log = 0 or 1) % % Whole thing will be translated to origin: - \advance\pst@dima-\pst@dimg% Dist. from bl-x to o-x - \advance\pst@dimb-\pst@dimh% Dist. from bl-y to o-y + \advance\pst@dima-\pst@dimg% Dist. from ll-x to o-x + \advance\pst@dimb-\pst@dimh% Dist. from ll-y to o-y \advance\pst@dimc-\pst@dimg% Dist. from ur-x to o-x \advance\pst@dimd-\pst@dimh% Dist. from ur-y to o-y % Make lines/arrows or frame: @@ -1602,12 +1627,8 @@ \ifdim\pst@dima=\z@\else\showoriginfalse\fi% \ifnum\psk@dy=\z@% \pst@dimg=\psk@Dy\psyunit% - \ifnum\Pst@Debug>0 \typeout{==DEBUG== pst-plot(psaxes@iv): \textbackslash pst@dimg=\the\pst@dimg}\fi % v.1.21 - \ifdim\pst@dimg<\p@ \pst@cnta=\psk@Dy \edef\psk@Dy{-\the\pst@cnta} % v.1.21 - \ifnum\Pst@Debug>0 \typeout{==DEBUG== pst-plot(psaxes@iv): Dy -> -Dy (was negative)}\fi % v.1.21 - \fi % v.1.21 + \ifdim\pst@dimg<\p@ \pst@cnta=\psk@Dy \edef\psk@Dy{-\the\pst@cnta}\fi % v.1.21 \edef\psk@dy{\number\pst@dimg}% - \ifnum\Pst@Debug>0 \typeout{==DEBUG== pst-plot(psaxes@iv): \textbackslash psk@dy=\psk@dy}\fi % v.1.21 \fi% \ifPst@xAxis\else\showorigintrue\fi% \pst@vlabels{\pst@dimd}{\psk@arrowB}{#3}{#5}% @@ -1620,12 +1641,9 @@ \ifdim\pst@dimb=\z@\else\showoriginfalse\fi% \ifnum\psk@dx=\z@% \pst@dimg=\psk@Dx\psxunit% - \ifnum\Pst@Debug>0 \typeout{==DEBUG== pst-plot(psaxes@iv): \textbackslash pst@dimg=\the\pst@dimg}\fi % v.1.21 \ifdim\pst@dimg<\p@ \pst@cnta=\psk@Dx \edef\psk@Dx{-\the\pst@cnta} % v.1.21 - \ifnum\Pst@Debug>0 \typeout{==DEBUG== pst-plot(psaxes@iv): Dx -> -Dx (was negative)}\fi % v.1.21 \fi % v.1.21 \edef\psk@dx{\number\pst@dimg}% - \ifnum\Pst@Debug>0 \typeout{==DEBUG== pst-plot(psaxes@iv): \textbackslash psk@dx=\psk@dx}\fi % v.1.21 \fi% \ifPst@yAxis\else\showorigintrue\fi% \pst@hlabels{\pst@dimc}{\psk@arrowB}{#4}{#6}% @@ -1651,31 +1669,35 @@ \newdimen\pst@yticksizeC % \def\set@xticksize#1{% - \pst@expandafter\pst@getydimdim{#1} {} {}\@nil % y-unit!! - \pst@xticksizeA=\the\pst@dimm% - \pst@xticksizeB=\the\pst@dimn% + \pst@expandafter\pst@getydimdim{#1} {} {}\@nil % y-unit!! + \ifdim\pst@dimm>\pst@dimn % first > second value + \pst@xticksizeA=\the\pst@dimn% + \pst@xticksizeB=\the\pst@dimm% + \else + \pst@xticksizeA=\the\pst@dimm% + \pst@xticksizeB=\the\pst@dimn% first > second value + \fi \edef\psk@xticksize{\pst@number\pst@xticksizeA \pst@number\pst@xticksizeB}% - \ifdim\pst@dimm=\z@\relax - \pst@xticksizeC=\z@ - \else% - \pst@absdim{\pst@xticksizeA}\pst@dimm% - \pst@absdim{\pst@xticksizeB}\pst@dimn% - \pst@maxdim{\pst@dimm}{\pst@dimn}\pst@dimo% - \pst@xticksizeC=\pst@dimo% + \ifnum\psk@xlabelPos<\z@ % top + \pst@xticksizeC=\pst@dimn + \else + \pst@xticksizeC=\pst@dimm% bottom \fi% } \def\set@yticksize#1{% \pst@expandafter\pst@getxdimdim{#1} {} {}\@nil % x-unit! - \pst@yticksizeA=\the\pst@dimm% - \pst@yticksizeB=\the\pst@dimn% + \ifdim\pst@dimm>\pst@dimn % first > second value + \pst@yticksizeA=\the\pst@dimn% + \pst@yticksizeB=\the\pst@dimm% + \else + \pst@yticksizeA=\the\pst@dimm% + \pst@yticksizeB=\the\pst@dimn% first > second value + \fi \edef\psk@yticksize{\pst@number\pst@yticksizeA \pst@number\pst@yticksizeB}% - \ifdim\pst@dimm=\z@\relax - \pst@yticksizeC=\z@ - \else% - \pst@absdim{\pst@yticksizeA}\pst@dimm% - \pst@absdim{\pst@yticksizeB}\pst@dimn% - \pst@maxdim{\pst@dimm}{\pst@dimn}\pst@dimo% - \pst@yticksizeC=\pst@dimo% + \ifnum\psk@ylabelPos<\z@ % right + \pst@yticksizeC=\pst@dimn + \else + \pst@yticksizeC=\pst@dimo% left \fi% } \define@key[psset]{}{ticksize}{\set@xticksize{#1}\set@yticksize{#1}} @@ -1698,24 +1720,6 @@ \@pstrickserr{Bad tick style: `#1#2'}\@ehpa \fi\fi\fi } - -\iffalse -\define@key[psset]{}{tickstyle}{% - \pst@expandafter\psset@@tickstyle{#1}\@nil% - \pst@cnta=\psk@tickstyle - \advance\pst@cnta by \@ne - \ifcase\pst@cnta% bottom - \pst@xticksizeB=\z@ - \pst@yticksizeB=\z@ - \or% full - \or% top - \pst@xticksizeA=\z@ - \pst@yticksizeA=\z@ - \fi -} -\fi -%\psset{tickstyle=full}% -% % \define@key[psset]{pstricks-add}{subticks}{\def\psk@xsubticks{#1}\def\psk@ysubticks{#1}} \define@key[psset]{pstricks-add}{xsubticks}{\def\psk@xsubticks{#1}} @@ -2000,20 +2004,22 @@ } % Knows \pst@dimb and \pst@cnta \def\pst@@hlabels{% - \pst@dimm=\pst@xticksizeC\advance\pst@dimm by \pslabelsep% + \psDEBUG[pst@@hlabels]{xticksizeC=\the\pst@xticksizeC}% \vbox to\z@{% - \ifdim\pst@dimd>\z@\vskip\pst@dimm\else\vss\fi% - \ifnum\pst@cnta<\z@\pst@dimb=-\pst@dimb\fi% + \ifcase\psk@xlabelPos + \vskip-\pst@xticksizeA\vskip\pslabelsep\or + \vskip-1ex\or% + \vskip-\pst@xticksizeB\vskip-\pslabelsep\vskip-1ex% + \fi% \hbox to\z@{% + \ifnum\pst@cnta<\z@\pst@dimb=-\pst@dimb\fi% \ifshoworigin\hbox to \z@{\hss\pst@@@hlabel{\psk@Ox}\hss}\fi% \mmultido{\nA=\psk@Ox+\psk@Dx}{\pst@cnta}{% \hskip\pst@dimb\hbox to \z@{\hss% \ifdim\nA pt=\z@ \pst@@@hlabel{0}\else\expandafter\pst@@@hlabel{\nA}\fi% prevent -0, doesn't work with \ifnum -% \ifnum\nA=0 \pst@@@hlabel{0}\else\expandafter\pst@@@hlabel{\nA}\fi \hss}% }\hss% - }% - \ifdim\pst@dimd>\z@\vss\else\vskip\pst@dimm\fi% + } }}% % #1:Max/Min in pt from origin; #2:arrow; #3:min; #4:max @@ -2034,33 +2040,32 @@ % \pst@dima: the width between two labels in pt % \pst@dimc: the coordinate of the origin in pt % \pst@cnta: the lowest label +% \pst@ticksizeC the lowest or highest value \def\pst@@vlabels{% - \pst@dimm=\pst@yticksizeC% - \advance\pst@dimm by \pslabelsep% + \psDEBUG[pst@@vlabels]{yticksizeC=\the\pst@yticksizeC}% +% for left labels we use \def\llap#1{\hb@xt@\z@{\hss#1}} \vbox to\z@{% - \ifnum\pst@cnta>\z@\pst@dima=-\pst@dima\fi% + \ifnum\pst@cnta>\z@ \pst@dima=-\pst@dima\fi% up or down label positions \offinterlineskip% - \ifshoworigin + \ifshoworigin% \vbox to \z@{\vss\hbox to\z@{% - \ifdim\pst@dimc>\z@\hss\else\hskip\pst@dimm\fi - \pst@@@vlabel{\psk@Oy}% - \ifdim\pst@dimc>\z@\hskip\pst@dimm\else\hss\fi}\vss}% + \ifcase\psk@ylabelPos + \hss\pst@@@vlabel{\psk@Oy}\hskip\pslabelsep\hskip-\pst@yticksizeA\or + \hskip\pslabelsep\hss\pst@@@vlabel{\psk@Oy}\hss\or % right labels + \hskip\pst@yticksizeB\hskip\pslabelsep\pst@@@vlabel{\psk@Oy}% + \fi}\vss}% \fi% \mmultido{\nA=\psk@Oy+\psk@Dy}{\pst@cnta}{% - \vbox to\pst@dima{\vss} + \vbox to\pst@dima{\vss}% \vbox to \z@{% \vss\hbox to\z@{% - \ifdim\pst@dimc>\z@% - \hss\pst@@@vlabel{\nA}\hskip\pst@dimm% - \else% - \hskip\pst@dimm%\ifnum\nA=0 \pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi - \ifdim\nA pt=\z@ \pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi% prevent -0, doesn't work with \ifnum - \hss% - \fi - }\vss% - }}% - \vss% -}} + \ifcase\psk@ylabelPos% and also check for -0 + \hss\ifdim\nA pt=\z@ \pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi\hskip\pslabelsep\hskip-\pst@yticksizeA\or + \hskip\pslabelsep\hss\ifdim\nA pt=\z@ \pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi\hss\or % right labels + \hskip\pst@yticksizeB\hskip\pslabelsep\ifdim\nA pt=\z@ \pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi% + \fi}\vss} + }\vss}% +} % \define@key[psset]{pstricks-add}{nStep}{\def\psk@nStep{#1}} \define@key[psset]{pstricks-add}{nStart}{\def\psk@nStart{#1}} @@ -2184,8 +2189,19 @@ \define@key[psset]{pstricks-add}{xAxisLabel}{\def\psk@xAxisLabel{#1}} \define@key[psset]{pstricks-add}{yAxisLabel}{\def\psk@yAxisLabel{#1}} %\psset{xAxisLabel=x,yAxisLabel=y} +\iffalse +\define@key[psset]{pstricks-add}{xAxisLabelPos}{% + \def\pst@tempA{#1}% + \ifx\pst@tempA\@empty\let\psk@xAxisLabelPos\relax\else + \pst@getcoor{#1}\psk@xAxisLabelPos\fi} +\define@key[psset]{pstricks-add}{yAxisLabelPos}{% + \def\pst@tempA{#1}% + \ifx\pst@tempA\@empty\let\psk@yAxisLabelPos\relax\else + \pst@getcoor{#1}\psk@yAxisLabelPos\fi} +\fi \define@key[psset]{pstricks-add}{xAxisLabelPos}{\def\psk@xAxisLabelPos{#1}} \define@key[psset]{pstricks-add}{yAxisLabelPos}{\def\psk@yAxisLabelPos{#1}} + %\psset{yAxisLabelPos={},xAxisLabelPos={}} % \newdimen\psk@llx @@ -2231,7 +2247,7 @@ \use@par% \psaxes(#1,#2)(#3,#4)% \egroup% - \psgraph@vi(#1,#2)(#3,#4)% + \psgraph@vi(#1,#2)(#1,#2)(#3,#4)% } \def\psgraph@v(#1,#2)(#3,#4)(#5,#6)#7#8{% with special origin % Xorig | yorig | minX | minY | maxX | maxY | Length x-axis | length y-axis% @@ -2256,18 +2272,34 @@ \use@par% \psaxes(#1,#2)(#3,#4)(#5,#6)% \egroup% - \psgraph@vi(#1,#2)(#5,#6)% + \psgraph@vi(#1,#2)(#3,#4)(#5,#6)% } -\def\psgraph@vi(#1,#2)(#3,#4){% +% +\def\setxLabelC@@r#1,#2(#3,#4){% + \ifx#1c + \pssetylength\pst@dimm{#2} + \rput(! #4 #3 add 2 div \pst@number\pst@dimm \pst@number\psyunit div ){\psk@xAxisLabel} + \else + \pst@getcoor{\psk@xAxisLabelPos}\pst@tempA + \rput(! \pst@tempA\space \tx@UserCoor ){\psk@xAxisLabel} + \fi} +\def\setyLabelC@@r#1,#2(#3,#4){% + \ifx#2c + \pssetxlength\pst@dimm{#1} + \rput{90}(! \pst@number\pst@dimm \pst@number\psxunit div #4 #3 add 2 div ){\psk@yAxisLabel} + \else + \pst@getcoor{\psk@yAxisLabelPos}\pst@tempA + \rput{90}(! \pst@tempA\space \tx@UserCoor ){\psk@yAxisLabel} + \fi} +% +\def\psgraph@vi(#1,#2)(#3,#4)(#5,#6){% \ifx\psk@xAxisLabel\@empty\else% - \ifx\psk@xAxisLabelPos\@empty\uput[0](#3,#2){\psk@xAxisLabel}% - \else\rput(\psk@xAxisLabelPos){\psk@xAxisLabel}% - \fi% + \ifx\psk@xAxisLabelPos\@empty \uput[0](#5,#2){\psk@xAxisLabel}% + \else \expandafter\setxLabelC@@r\psk@xAxisLabelPos(#3,#5)\fi% \fi% \ifx\psk@yAxisLabel\@empty\else% - \ifx\psk@yAxisLabelPos\@empty\uput[90](#1,#4){\psk@yAxisLabel}% - \else\rput{90}(\psk@yAxisLabelPos){\psk@yAxisLabel}% - \fi% + \ifx\psk@yAxisLabelPos\@empty \uput[90](#1,#6){\psk@yAxisLabel}% + \else \expandafter\setyLabelC@@r\psk@yAxisLabelPos(#4,#6)\fi% \fi% \ignorespaces% } @@ -3225,9 +3257,11 @@ arrowLW=0, dashNo=0.2,linecap=0, xyAxes=true, + xlabelPos=bottom, ylabelPos=left, trigLabels=false,trigLabelBase=0, xDecimals={},yDecimals={}, xlogBase={},ylogBase={}, + labelFontSize={},mathLabel, logLines=none, ignoreLines=0, nStep=1,nStart=0,nEnd={}, @@ -3239,7 +3273,7 @@ randomPoints=1000,color=false, method={},whichabs={},whichord={}, plotfuncx={},plotfuncy={},buildvector=false, -% algebraic=false, % indivisuelly set +% algebraic=false, % individuelly set Derive={},adamsorder=4, VarStep=false, PlotDerivative=none, VarStepEpsilon=default, varsteptol=.001, |