I'd like to use the PSTricks functionality to get the contour plots of 3D surfaces (more precisely, corresponding to functions z = f(x,y) from R^2 to R). Since, to the best of my knowledge, there is no package including this functionality, I've resorted to using the pst-solides3d
package in order to plot the surface with an appropriate range of colors encoding the z value and choosing the viewpoint with an azimuthal angle set to 90 (sexagesimal degrees). In some cases this works (I've obtained good results with some trigonometric functions). In others, the result is simply wrong: I've tried with a parabolloid z = x^2 + y^2 having the plot restricted to the first octant and (x,y) \leq (1,1), but the view I've obtained with the azimuthal angle set to 90 degrees is flawed.
What follows is an MWE for the parabolloid:
\documentclass{memoir}
\usepackage[pdfcrop={--hires}]{auto-pst-pdf}
\usepackage{xcolor,pstricks,pst-solides3d}
\begin{document}
\pagestyle{empty}
\psset{unit=3cm}
\begin{pspicture}(-2,-2)(2,2)
\psset{lightsrc=viewpoint,
viewpoint=60 0 90 rtp2xyz,
Decran=60}
\psSurface[linewidth=0.01pt,
ngrid=0.01 0.01,
tablez=0 0.01 2 {} for,
zcolor=0.5 0,
grid](0,0)(1,1){x x mul y y mul add}
\end{pspicture}
\end{document}
Please observe how the boundary of the plot is not actually a square -- as it should from the viewpoint I've chosen -- because it curves near the corner corresponding to the point (1,1,0). This is wy I say that the plot is ``flawed''.
I know there are two Perl scripts available from http://tug.org/PSTricks/main.cgi?file=pst-plot/3D/contour that have been devised with the aim to providing the functionality I'm looking for, but both links to the scripts lead actually to the same script, namely, to MakeData.pl
. Besides, there are no indications as to what to do with them. I'm using the MikTeX 2.9 distribution; are the scripts to be saved in the miktex/bin
folder, where other scripts are saved? Could anyone possibly provide any further hints as to how to use these scripts?
On the other hand, anyone knows of a different approach to obtain contour plots with PSTricks-based techniques?