Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My question is pretty much a duplicate of this one. I'd like pgfplots to display the intersection between tho surface plots properly. Unfortunately, my function is quite different from the one in the mentioned question, so I don't know, where the surfaces will meet. Would there be any kind of workaround for this kind of function?

\documentclass{scrartcl}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=0.01:30]
\addplot3[surf] {0};
\addplot3[surf] {(1-0.3)*e^(-x*(y/100)*(1-0.3))-e^(-x*(y/100))};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

share|improve this question
2  
Unfortunately, I think this is a job for PSTricks... –  Jake Sep 24 '12 at 19:05
    
As Jake already said, this is beyond the capabilities of pgfplots. The golatex forum has a related post in which the OP managed to generate the graphics as such with matlab and imported it via \addplot3 graphics: golatex.de/… (in german only - but pictures speak in their own language, I guess) –  Christian Feuersänger Sep 25 '12 at 18:40

2 Answers 2

up vote 7 down vote accepted

Another hackish solution:

withlines

\documentclass{scrartcl}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=0.01:30]
\addplot3[surf] {min(0.,(1-0.3)*e^(-x*(y/100)*(1-0.3))-e^(-x*(y/100))};
\addplot3[surf] {max(0.,(1-0.3)*e^(-x*(y/100)*(1-0.3))-e^(-x*(y/100)))};
\addplot3[domain=4:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({x},{118.89/x},{0.});
\addplot3[domain=0:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({x},{30.},{max(0.,(1-0.3)*e^(-x*(30./100)*(1-0.3))-e^(-x*(30./100)))});
\addplot3[domain=0:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({x},{0.},{max(0.,(1-0.3)*e^(-x*(0./100)*(1-0.3))-e^(-x*(0./100)))});
\addplot3[domain=0:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({x},{0.},{min(0.,(1-0.3)*e^(-x*(0./100)*(1-0.3))-e^(-x*(0./100)))});
\addplot3[domain=0:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({0.},{x},{max(0.,(1-0.3)*e^(-0.*(x/100)*(1-0.3))-e^(-0.*(x/100)))});
\addplot3[domain=0:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({30.},{x},{max(0.,(1-0.3)*e^(-30.*(x/100)*(1-0.3))-e^(-30.*(x/100)))});
\addplot3[domain=0:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({30.},{x},{min(0.,(1-0.3)*e^(-30.*(x/100)*(1-0.3))-e^(-30.*(x/100)))});
\end{axis}
\end{tikzpicture}
\end{document}

Note that this kind of solution is less flexible, because the correct hidden surface removal depends on the position of the camera, and also on special properties of shape of the functions. If one could know the point of view internally, one could generalize the max and min function to make it camera dependent and in this way simulate hidden surfaces.

share|improve this answer
    
Thanks a lot for both your solutions. Would you be so kind as to explain the rationale behind the value 118.89 and especially behind the second solution? I won't need different camera angles, but I will need to plot a lot of similar functions. –  meep.meep Sep 25 '12 at 8:20
    
Second solution meaning this one, the order changed because of my accepting this answer. –  meep.meep Sep 25 '12 at 9:20
    
I got the solution by myself. I just was missing the rule: ln(e^{f(x)}) = f(x). Using that, I now understand where the 118.89 come from. Thanks again. –  meep.meep Sep 25 '12 at 14:06

A combination of surface colors, opacities and parametric plots can get you close to the desired result:

intersection_picture

Code follows:

\documentclass{scrartcl}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=0.01:30]
\addplot3[surf, opacity=0.25, blue, shader=flat] {0};
\addplot3[surf, opacity=0.25] {(1-0.3)*e^(-x*(y/100)*(1-0.3))-e^(-x*(y/100))};
\addplot3+[domain=4:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({x},{118.89/x},{0.});
\end{axis}
\end{tikzpicture}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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