I am new to latex but heard about tikz from this site. I don't know whether tikz can draw the graph attached. The picture is a curve revolving to generate a volume. I used to use MS Office to get it done but take a long to draw and edit. Hopefully, latex can help. Thanks

revolving to generate volume

  • Please, show us what you have tried. Even with errors or ugly results.
    – Sigur
    Jun 18, 2015 at 9:49
  • Don't forget that you can and should accept the answer that best solves the question! Our reputations depend on it. Jun 24, 2015 at 3:20

2 Answers 2


One possibility

enter image description here

The code (includes comments):




    single arrow,
    minimum height=1.5cm,
    drop shadow,
% the axis lines
\draw[help lines,->,name path=xaxis]
  (-4.5,0) -- (4.5,0);
\draw[help lines,->,name path=yaxis]
  (0,-5) -- (0,4.5);
% the curve to the left
\draw[name path=leftcurve,thick] 
  (0.5,-4)  to[out=40,in=-110] 
  (2,0) to[out=70,in=-90] (3,4) node[above] {$x=f(y)$};
% the curve to the right (it's a reflection of the left curve)
\draw[name path=rightcurve,thick] 
  (0.5,-4)  to[out=40,in=-110] 
  (2,0) to[out=70,in=-90] (3,4);
% paths for the dashed horizontal lines
\path[name path=upperline] 
  (-4,2.5) -- (4,2.5);
\path[name path=lowerline] 
 (-4,-2.5) -- (4,-2.5);
% calculation of intersection points
% for the dashed lines and the curves 
\path[name intersections={of=upperline and rightcurve,by={a}}];
\path[name intersections={of=upperline and leftcurve,by={b}}];
\path[name intersections={of=lowerline and rightcurve,by={c}}];
\path[name intersections={of=lowerline and leftcurve,by={d}}];
% calculation of intersection points
% for the dashed lines and the y-axis
\path[name intersections={of=upperline and yaxis,by={e}}];
\path[name intersections={of=lowerline and yaxis,by={f}}];
% draw the dashed lines
  (a) -- (b);
  (c) -- (d);
% draw the upper ellipse
\draw[dashed] let
  (b) arc(0:180:0.5*\x2-0.5*\x1 and 12pt);
\draw[thick] let
  (b) arc(0:-180:0.5*\x2-0.5*\x1 and 12pt);
% draw the lower ellipse
\draw[dashed] let
  (d) arc(0:180:0.5*\x2-0.5*\x1 and 10pt);
\draw[thick] let
  (d) arc(0:-180:0.5*\x2-0.5*\x1 and 10pt);
% the gray background shading
  (a|-c) rectangle (b);
  (-3,4)  to[out=-90,in=110] 
  (-2,0) to[out=-70,in=140] 
  (-0.5,-4) --
  (0.5,-4) to[out=40,in=-110] 
  (2,0) to[out=70,in=-90] 
  (3,4) -- cycle;
% the arc indication rotation
  (15pt,-4.7) arc(0:-325:15pt and 3pt);
% the thick red arrows
  at (-2,3.7) {};
  at (-1.2,-1.4) {};
  at (-1.5,-4.4) {};
  at (-2.5,0.75) {};
% Some labels
\node[below left] 
  at (e) {$b$};
\node[below left] 
  at (f) {$a$};
\node[below right] 
  at (0,0) {$0$};
  at (4.5,0) {$x$};
  at (0,4.5,0) {$y$};


This solution permits you to draw the rotated solid of an arbitrary function of y.

For this I've borrowed some superficial elements from Gonzalo Medina's superb answer, namely the thick red arrows and the arc indicating rotation.

rotated solid

Here is the code:

\usetikzlibrary{shapes.arrows, shadows}

% This function is a contrivance, but it looks about right!
\newcommand\fofy[1]{{((#1*0.8)^3 - 2*(#1*0.8)^2 + 6*(#1*0.8) + 40) / 20}}


    \begin{tikzpicture}[>=latex, tharrow/.style={ fill=myred, single arrow, minimum height=1.5cm, drop shadow,}]
        % background shading
        \fill [black!15, domain=\Bbound:\Abound] plot({\fofy{\x}}, {\x}) -- ( {-\fofy{\Abound}}, \Abound)  [domain=\Abound:\Bbound] plot({-\fofy{\x}}, {\x}) -- ({\fofy{\Bbound}}, \Bbound);

        % function and mirror
            \draw plot({\fofy{\x}}, {\x}) node [above] {$x = f(y)$} ;
            \draw[black!60] plot({-\fofy{\x}}, {\x});

        % Ellipses and Limits
            % Lower
        \draw [dotted] ({\fofy{\Abound}}, \Abound) arc (0:180:{\AboundYval} and {\AboundYval * 0.18 } );
        \draw  ({\fofy{\Abound}}, \Abound) arc (0:-180:{\AboundYval} and {\AboundYval * 0.18 } );
        \draw[dashed] ({\fofy{\Abound}}, \Abound) -- ({-\fofy{\Abound}}, \Abound cm) node [midway, below left] {$a$};
            % Upper
        \draw [dotted] ({\fofy{\Bbound}}, \Bbound) arc (0:180:{\BboundYval} and {\BboundYval * 0.18 } );
        \draw  ({\fofy{\Bbound}}, \Bbound) arc (0:-180:{\BboundYval} and {\BboundYval * 0.18 } );
        \draw[dashed] ({\fofy{\Bbound}}, \Bbound) -- ({-\fofy{\Bbound}}, \Bbound) node [midway, above left] {$b$};

        % arc indicating rotation
        \draw[->] (10pt,-3.15) arc(0:-310:10pt and 3pt);
        % big red arrows
        \node[tharrow,rotate=-50] at (-2,3.7) {};
        \node[tharrow,rotate=-55] at (-0.8,-1.3) {};
        \node[tharrow,rotate=-20] at (-1.4,-2.8) {};
        \node[tharrow,rotate=10]  at (-2.5,0.75) {};

        % axes
            [very thin, ->]
            \draw (0, -3.5cm)  -- (0, 3.5cm) node [at end, left] {$y$} ;
            \draw  (-3cm,0) -- node [black, below right] {$0$} (3cm,0) node [at end, below] {$x$};

The ability to plot arbitrary functions makes this useful for writing exam problems and solutions!

You must log in to answer this question.

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