I want to replicate the following figure.

enter image description here

I tried something as below

  \draw[-stealth] (0,0,0) -- (4,0,0) node[right] {$x$};
  \draw[-stealth] (0,0,0) -- (0,4,0) node[above] {$y$};
  \draw[-stealth] (0,0,0) -- (0,0,4) node[below left] {$z$};

  \shade[ball color=blue!40!white,opacity=0.5] (3,0) arc (0:90:3) {[x={(0,0,1)}] arc (90:0:3)} {[y={(0,0,1)}] arc (90:0:3)};


Can someone help me? Many thanks in advance.

  • Welcome to TeX.SX! On this site, a question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed because they are either "off topic", "too broad", or "unclear". Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help.
    – SebGlav
    Commented Jan 15, 2022 at 16:44

1 Answer 1


I think that the key here is where to put all the points (its coordinates). This can be a very good example of how to use the calc library which allows to situate one coordinate relative to another. And it's better to draw this one in 2d IMHO.

For example:

\usepackage{amsmath} % \boldsymbol
\usetikzlibrary{calc,decorations.pathreplacing} % decorations is for the 'underbrace'

  surface/.style={blue,shading=ball,fill opacity=0.4},
  plane/.style={green!40!black,fill=green!30!black,fill opacity=0.3},

\begin{tikzpicture}[line cap=round,line join=round,scale=2]
% coordinates
\coordinate (O)  at (0,0);
\coordinate (X)  at (234:2.5);
\coordinate (Y)  at (353:4.5);
\coordinate (Z)  at (0,3.2);
\coordinate (A)  at ($(O)!0.06!(Y)$);
\coordinate (B)  at ($(A)+(0,2.8)$);
\coordinate (C)  at ($(B)+(322:2.8)$);
\coordinate (D)  at ($(C)+(A)-(B)$);
\coordinate (E)  at ($(A)!0.75!(B)$);
\coordinate (P') at ($(A)!0.27!(D)$);
\coordinate (Q') at ($(A)!0.64!(D)$);
\coordinate (P)  at ($(P')+(0,2.4)$);
\coordinate (Q)  at ($(Q')+(0,2.15)$);
\coordinate (Sx) at ($(O)!0.72!(X)$);
\coordinate (Sy) at ($(O)!0.9!(Y)$);
\coordinate (Sz) at ($(O)!0.62!(Z)$);
\coordinate (T1) at ($(P)-(322:1)$);
\coordinate (T2) at ($(P)+(322:1.3)$);
\coordinate (R1) at ($(P')-(X)$);
\coordinate (R2) at ($(Q')-(Y)$); 
\coordinate (R3) at (intersection of P'--R1 and Q'--R2);
% axes
\draw[-latex] (O) -- (X) node (X) [left]  {$x$};
\draw[-latex] (O) -- (Y) node (Y) [right] {$y$};
\draw[-latex] (O) -- (Z) node (Z) [above] {$z$};
% plane, back
\draw[plane] (D) to[out=90,in=305] (Q) to [out=125,in=322] (P) to[out=142,in=10] (E) -- (A) -- cycle;
% surface S
\draw[surface] (Sx) to[out=-25,in=200,looseness=0.7] (D) to[out=20,in=240,looseness=0.7] (Sy) 
                    to[out=100,in=10] (E) to[out=190,in=20] (Sz) to[out=220,in=100] cycle;
% plane, front
\draw[plane] (D) to[out=90,in=305] (Q) to [out=125,in=322] (P)
                 to[out=142,in=10] (E) -- (B) -- (C) -- cycle;                                        
% curve C
\draw[curve] (D) to[out=90,in=305] (Q) to [out=125,in=322] (P) to[out=142,in=10] (E);
% tangent
\draw[thick,red] (T1) -- (T2);
% triangle
\draw[dashed] (P) -- (P') -- (R3) node[pos=0.4,left] {$ha$} -- (Q') node[midway,below] {$hb$} -- (Q);
\draw (R3) ++ (54:0.1) --++ (353:0.15) -- ($(R3)+(353:0.15)$);
% vector
\draw[thick,red,-latex] (P') -- ($(P')!0.7!(D)$) node [midway,yshift=3mm] {$\boldsymbol{\mathrm{u}}$};
% points
\foreach\i in{P',Q',P,Q}
  \fill (\i) circle [radius=.25mm];
% labels
\draw[latex-,shorten <=2mm,shorten >=4mm] (P)  -- (1.8, 2.3) node {$P(x_0,y_0,z_0)$};
\draw[latex-,shorten <=2mm,shorten >=2mm] (Q') -- (1.6,-1.6) node {$Q'(x,y,0)$};
\draw[underbrace] (P') -- (Q') node [pos=0.3,yshift=-5mm] {$h$};
\node at (Q)        [right] {$Q(x,y,z)$};
\node at (P')       [left]  {$P'(x_0,y_0,0)$};
\node at (T1)       [below] {$T$};
\node at (-1.1,0.7) [blue]  {$S$};
\node at  (2.1,0.7) [curve] {$C$};

enter image description here

  • 1
    Hi Juan, thank you so much for your help again 👍👍👍
    – Ben
    Commented Jan 15, 2022 at 18:49
  • At this point, Juan, you should be payed ;) +1
    – SebGlav
    Commented Jan 16, 2022 at 18:49
  • 1
    @SebGlav, mmm, not a bad idea, XDDD. Thanks!!! Commented Jan 16, 2022 at 22:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .