我正在尝试创建这个图表,
因为我不熟悉tikzpicture
,但在完成教程后,我想到了这一点:
代码如下:
\usepackage{tikz}
\usepackage{pgf}
\usepackage{pgfplots}
\usetikzlibrary{positioning,shapes,calc, decorations.pathreplacing, arrows, decorations.pathmorphing, backgrounds, fit, shapes.symbols, decorations.text,automata}
\begin{document}
\begin{tikzpicture} %[>=latex,shorten >=2pt,shorten <=2pt,shape
aspect=1] %\node (A) [cylinder, shape border rotate=90, draw,minimum
%height=4cm,minimum width=2cm] %{A};
%\draw (0,0) ellipse (1.25 and 0.5);); \fill [white,opacity=0.5]
(-1.25,0) -- (-1.25,-3.5) arc (180:360:1.25 and 0.5) -- (1.25,0) arc
(0:180:1.25 and -0.5); \draw (-1.25,0) -- (-1.25,-3.5); \draw
(-1.25,-3.5) arc (180:360:1.25 and 0.5); %\draw [dashed] (-1.25,-3.5)
arc (180:360:1.25 and -0.5); \draw (1.25,-3.5) -- (1.25,0);
\draw (-0.3,-4) -- (-0.3,-4.5); \draw (0.3,-4) -- (0.3,-4.5);
\draw[dashed] (-1.2,-1.5) -- (1.2,-1.5) node [midway,
above,fill=white] {$x_1$}; \draw[dashed] (-1.2,-3.3) -- (1.2,-3.3)
node [midway, above,fill=white] {$r_1$};
\qquad
%[>=latex,shorten >=2pt,shorten <=2pt,shape aspect=1] %\node (A)
[cylinder, shape border rotate=90, draw,minimum %height=4cm,minimum
width=2cm] %{A};
%\draw (0,0) ellipse (1.25 and 0.5); \draw (3.25,0) -- (3.25,-3.5);
\draw (3.25,-3.5) arc (180:360:1.25 and 0.5); %\draw [dashed]
(-1.25,-3.5) arc (180:360:1.25 and -0.5); \draw (5.75,-3.5) --
(5.75,0); \fill [white,opacity=0.5] (3.25,0) -- (3.25,-3.5) arc
(180:360:1.25 and 0.5) -- (1.25,0) arc (0:180:1.25 and -0.5);
\draw (4.2,-4) -- (4.2,-4.5); \draw (4.8,-4) -- (4.8,-4.5);
\draw[dashed] (2.9,-1.5) -- (5.7,-1.5) node [midway, above,fill=white]
{$x_2$}; \draw[dashed] (2.9,-3.3) -- (5.7,-3.3) node [midway,
above,fill=white] {$r_2$};
\end{tikzpicture}
\end{document}
我还有很长的路要走,但如果有人能帮助我创建这个图表就太好了。谢谢。
答案1
经过一番努力:
\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{calc,arrows.meta}
\begin{document}
\begin{tikzpicture}[thick]
\fill[top color=gray!50!black,bottom color=blue!10,middle color=gray,shading=axis,opacity=0.25] (0,0) circle (2cm and 0.5cm);
\fill[left color=gray!50!black,right color=blue!50!black,middle color=gray!50,shading=axis,opacity=0.25] (2,0) -- (2,4) arc (360:180:2cm and 0.5cm) -- (-2,0) arc (180:360:2cm and 0.5cm);
\fill[top color=blue!90!,bottom color=blue!2,middle color=blue!30,shading=axis,opacity=0.25] (0,4) circle (2cm and 0.5cm);
\draw (-2,4) -- (-2,0) arc (180:360:2cm and 0.5cm) -- (2,4) ++ (-2,0) circle (2cm and 0.5cm);
\draw[] (-2,0) arc (180:0:2cm and 0.5cm) ;
\draw[] (-2,2.6) arc (180:0:2cm and 0.5cm) ;
\draw[] (-2,2.6) node [left] {$X_1$} arc (180:360:2cm and 0.5cm);
\draw[densely dashed] (-2,1.2)node [left] {$\gamma_1$} arc (180:360:2cm and 0.5cm);
\draw[densely dashed] (-2,1) arc (180:0:2cm and 0.5cm);
\draw [bend right] (-2,0) to (-0.5,-2)coordinate (A);
\draw [bend left] (2,0) to (0.5,-2) coordinate (B);
\draw [] (A) -- (-0.5,-3) coordinate (C);\draw [] (B) -- (0.5,-3)coordinate (D);
\draw[] (C) arc (180:0:0.5cm and 0.2cm) ;
\draw[] (C) arc (180:360:0.5cm and 0.2cm) ;
\draw[double,-latex] (0,-3) -- (0,-4.5)node[left]{$V_1$};
\draw[] (2.25,6)coordinate(A)--(2.25,8);
\draw[] (2.75,6)--(2.75,8);
\draw[] (A) arc (180:0:0.25cm and 0.1cm) ;
\draw[] (A) arc (180:360:0.25cm and 0.1cm) ;
\draw[double,-latex] (2.25,5.75) -- (0,4);
\draw[double,-latex] (2.75,5.75) -- (5,4);
\hspace{5cm}
\fill[top color=gray!50!black,bottom color=blue!10,middle color=gray,shading=axis,opacity=0.25] (0,0) circle (2cm and 0.5cm);
\fill[left color=gray!50!black,right color=blue!50!black,middle color=gray!50,shading=axis,opacity=0.25] (2,0) -- (2,4) arc (360:180:2cm and 0.5cm) -- (-2,0) arc (180:360:2cm and 0.5cm);
\fill[top color=blue!90!,bottom color=blue!2,middle color=blue!30,shading=axis,opacity=0.25] (0,4) circle (2cm and 0.5cm);
\draw (-2,4) -- (-2,0) arc (180:360:2cm and 0.5cm) -- (2,4) ++ (-2,0) circle (2cm and 0.5cm);
\draw[] (-2,0) arc (180:0:2cm and 0.5cm) ;
\draw[] (-2,2.6) arc (180:0:2cm and 0.5cm) ;
\draw[] (-2,2.6) arc (180:360:2cm and 0.5cm)node [right] {$X_2$};
\draw[densely dashed] (-2,1.2) arc (180:360:2cm and 0.5cm)node [right] {$\gamma_2$};
\draw[densely dashed] (-2,1) arc (180:0:2cm and 0.5cm);
\draw [bend right] (-2,0) to (-0.5,-2)coordinate (A);
\draw [bend left] (2,0) to (0.5,-2) coordinate (B);
\draw [] (A) -- (-0.5,-3) coordinate (C);\draw [] (B) -- (0.5,-3)coordinate (D);
\draw[] (C) arc (180:0:0.5cm and 0.2cm) ;
\draw[] (C) arc (180:360:0.5cm and 0.2cm) ;
\draw[double,-latex] (0,-3) -- (0,-4.5)node[right]{$V_2$};
\end{tikzpicture}
\end{document}