Graphics, Figures & TablesHow to create this Solid of Revolution

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
coachbennett1981
Posts: 269
Joined: Fri Feb 05, 2010 10:15 pm

How to create this Solid of Revolution

Post by coachbennett1981 »

Hey Everyone,

I have received some help on this, but I am trying to figure out a way to draw solids of revolution without 3-D software. I am trying to draw the attached figure. Here is what I have:

Code: Select all

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\pgfplotsset{compat=newest}
\usepackage{amssymb}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{plotmarks}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.misc, positioning}
\usetikzlibrary{arrows,shapes,positioning}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{arrows.meta,bending}
\tikzset{font=\footnotesize}

\begin{document}
    \begin{tikzpicture}
        \begin{axis}[thick,
                        scale only axis,
                        axis lines=middle,
                        inner axis line style={-Triangle},
                        ymin=-5,
                        ymax=5,
                        xmin=-1,
                        xmax=3,
                    ]
                    \addplot[name path=f,thick, red,samples=1000,domain=0:2]{x^2+1};
                    \addplot[name path=g,thick,blue, samples=1000,domain=0:2]{-x^2-1};
                   \draw[thick,dashed] (axis cs:2,0) ellipse [x radius=0.8cm,y radius =3.4cm] ;
                  \draw[thick,dashed] (axis cs:0.7,0) ellipse [x radius=.3cm,y radius=1cm] ;
                \end{axis}



    \end{tikzpicture}
\end{document}
Most of it was trial and error. Is there a more efficient way? I would like to draw different figures
Attachments
Screen Shot 2023-03-23 at 9.52.03 AM.png
Screen Shot 2023-03-23 at 9.52.03 AM.png (745.94 KiB) Viewed 1955 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

How to create this Solid of Revolution

Post by Stefan Kottwitz »

Hi Nick,

you could use pgfplots to show it in 3D with TikZ in LaTeX. Find the right formula and make a nice surface plot.

Take a look here: https://pgfplots.net/tag/3d/

Stefan
LaTeX.org admin
coachbennett1981
Posts: 269
Joined: Fri Feb 05, 2010 10:15 pm

How to create this Solid of Revolution

Post by coachbennett1981 »

Thank you. I will take a look
coachbennett1981
Posts: 269
Joined: Fri Feb 05, 2010 10:15 pm

How to create this Solid of Revolution

Post by coachbennett1981 »

I wanted to avoid the 3d look of it and keep to more traditional pics (similar to the textbook I am using)
Post Reply