plotting functions in pstricks
Michael M. Dougherty
dougheM at swosu.edu
Mon Oct 16 16:48:30 CEST 2000
-----------------------------------------------------------------------------
This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.
-----------------------------------------------------------------------------
The Latex Companion is not where you'll find much help. The Latex Graphics
companion has some stuff. Try to find the original pstricks manual. You can
start
at http://www.tug.org/applications/PSTricks/ for example. (If you still
have trouble, I can dig up my postscript version.)
There is an example in the manual. You have to know that you are entering
postscipt-speak, which uses RPN (Reverse Polish Notation). I'll give you
some examples below. You can look at the Adobe Postscript Manual to find the
functions which are included there. You need to \include{pst-plot}
(and of course \include{pstricks}) in the first lines of your latex file.
%%%This example should be self-explanatory (you can skip the figure and caption
%%%commands if you'd like.
\begin{figure}
\begin{center}
\begin{pspicture}(-2.5,-5)(2.5,5)
\psset{xunit=1.5cm}
\psset{yunit=.25cm}
\psaxes[Dy=5]{<->}(0,0)(-4,-20)(4,20)
\psplot[linewidth=1.5pt,plotstyle=curve]%
{-3}{3}{x dup mul 2 mul x 4 mul sub 17 sub}
\end{pspicture}
\end{center}
\caption{Actual graph of $y=f(x)$ where $f(x)=2x^2-4x-17$,
$x\in[-3,3]$.}\label{absbound1}
\end{figure}
%%%%%%%%% This one gives you 3|sin(45 degrees * x)| for x\in[0,4],
%%%%%%%%% and y=-2x for in[-2,0]. (I got lazy with the -2x syntax).
%%%%%%%%% It also puts a couple of dots at some strategic points.
\begin{center}
\begin{pspicture}(-5,-1)(5,6)
\rput(0,5.5){$y=f(x)$}
\psaxes{<->}(0,0)(-5,-.5)(5,5)
\psplot[plotpoints=400]{0}{4}{45 x mul sin abs 3 mul}
\psplot{-2}{0}{x 0 2 sub mul}
\pscircle[fillstyle=solid,fillcolor=black](2,3){.1}
\pscircle[fillstyle=solid,fillcolor=black](0,0){.1}
\pscircle[fillstyle=solid,fillcolor=black](4,0){.1}
\pscircle[fillstyle=solid,fillcolor=black](-2,4){.1}
\rput(-2,4.5){$(-2,4)$}
\rput(2,3.5){$(2,3)$}
\end{pspicture}
\end{center}
I hope this helps get you started. Let me/us know if we can
be of any further help. (Also, am I addressing your question?)
Anja Kreysch wrote:
>
> -----------------------------------------------------------------------------
> This is the PSTricks mailing list, devoted to discussions about computational
> graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
> For help using this mailing list, see instructions at the end of message.
> -----------------------------------------------------------------------------
>
> Hello,
> I would like to have some informations on how to make graphics, esp. plots
> of functions with ps-tricks. The Latex Companion is not available
> anymore.
> I found the packages that you can download from the internet to plot
> functions and I found examples. But I can't figure out how to write these
> functions with Latex.
> I would be glad if you sent me some stuff about it.
> Thanks a lot,
> Anja
>
> -----------------------------------------------------------------------------
> The list interface (subscription, information, access to the archives) is on:
> http://www.tug.org/cgi-bin/lwgate/pstricks
> Otherway to unsubscribe, send mail to pstricks-request at mail.tug.org
> with a blank subject and in body the line unsubscribe <email-address>
> -----------------------------------------------------------------------------
-----------------------------------------------------------------------------
The list interface (subscription, information, access to the archives) is on:
http://www.tug.org/cgi-bin/lwgate/pstricks
Otherway to unsubscribe, send mail to pstricks-request at mail.tug.org
with a blank subject and in body the line unsubscribe <email-address>
-----------------------------------------------------------------------------
More information about the PSTricks
mailing list