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/texmf-dist/doc | |
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/texmf-dist/doc')
-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 |
3 files changed, 869 insertions, 762 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$} %-------------------------------------------------------------------------------------- |