8

I'm starting doing graphs with PSTricks in 3D, but I can't reach a first good result.

What am I doing wrong?

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node}
\usepackage{pst-plot}
\usepackage[utf8]{inputenc}
\usepackage{eurosym}
% -------- Paquetes de pst-all \usepackage{pst-all}   paquete pstricks para        
\usepackage{pst-plot}
\usepackage{pst-node}
\usepackage{pst-tree}
\usepackage{pst-grad}
\usepackage{pst-coil}
\usepackage{pst-text}
\usepackage{pst-3d}
\usepackage{pst-eps}
\usepackage[tiling]{pst-fill}
\usepackage{pstricks-add}
\usepackage{multido}
% ---- Fin Paquetes de pst-all

\begin{document}
\psset{unit=1.5, Alpha=45, Beta=30}
\begin{pspicture}(-3,-1.5)(3,4)
\pstThreeDCoor[xMin=-4,xMax=4,yMin=-4,
yMax=4,zMax=3, arrows=<->]
\psplotThreeD[plotstyle=line,linecolor=blue,
yPlotpoints=40,xPlotpoints=30, linewidth=0.5pt,
hiddenLine=true](-2,2)(-2,2)
{
x 100 mul cos y 100 mul sin sub
}
\rput[tl](-2,3.5){$f(x,y)=\cos (100x) - \sin (100y) $ }
\end{pspicture}

\end{document} 
  • (1) Why are you loading all those packages? (That is not nessecasy at all.) (2) You need to load the pst-3dplot package. – Svend Tveskæg Jun 13 '13 at 15:41
  • Not one of the examples in this thread generate any visible results on my MikTeX distribution using WinShell. I can create a DVI file but it crashes YAP when I try to look at it and pdflatex only creates lots of "Error: Undefined control sequence.". – user39357 Nov 2 '13 at 7:45
  • Welcome to TeX.SX! Your question won't be seen by many people here, so it would be best to repost it as a fresh question. Follow-up questions like this are more than welcome! Please use the "Ask Question" link for your new question; there you can link to this question to provide the background. – jubobs Nov 2 '13 at 9:37
6

You just need the following:

% latex filname.tex
% dvips filname.dvi
% ps2pdf filname.ps

\documentclass{article}

\usepackage{pst-3dplot}

\begin{document}

\begin{pspicture}(-3.2,-2.73)(3.18,3.65)
\pstThreeDCoor[
  xMin = -4,
  xMax = 4,
  yMin = -4,
  yMax = 4,
  zMax = 3,
  arrows = <->
]
\psplotThreeD[
  plotstyle = line,
  linecolor = blue,
  yPlotpoints = 40,
  xPlotpoints = 30,
  linewidth = 0.5pt,
  hiddenLine = true
](-2,2)(-2,2)
{x 100 mul cos y 100 mul sin sub}
\rput(0,3.5){$f(x,y) = \cos(100x) - \sin(100y)$}
\end{pspicture}

\end{document}

output

11

You need the pst-3dplot package. You don't need all the others - here's a complete MWE

screenshot

% arara: latex
% arara: dvips
% arara: ps2pdf
% !arara: indent: {overwrite: on}
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-3dplot}

\begin{document}
\psset{unit=1.5, Alpha=45, Beta=30}
\begin{pspicture}(-3,-1.5)(3,4)
    \pstThreeDCoor[xMin=-4,xMax=4,yMin=-4,
    yMax=4,zMax=3, arrows=<->]
    \psplotThreeD[plotstyle=line,linecolor=blue,
        yPlotpoints=40,xPlotpoints=30, linewidth=0.5pt,
    hiddenLine=true](-2,2)(-2,2)
    {
        x 100 mul cos y 100 mul sin sub
    }
    \rput[tl](-2,3.5){$f(x,y)=\cos (100x) - \sin (100y) $ }
\end{pspicture}

\end{document} 
2

Another solution with package pst-solides3d

\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}
\begin{document}

\psset{unit=0.5,viewpoint=50 40 20 rtp2xyz,Decran=25,lightsrc=viewpoint,
  stepX=2,stepY=2,stepZ=2}
\begin{pspicture}(-9,-8)(8,6)
\psSurface[ngrid=.5 .5,linewidth=0.5\pslinewidth,axesboxed,
   algebraic,hue=0 1](-10,-10)(10,10){ cos(100*x)-sin(100*y) }
\end{pspicture}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.