Graphics, Figures & Tables ⇒ draw figure with Tikz
-
beningermany
- Posts: 10
- Joined: Tue Aug 21, 2018 5:55 pm
draw figure with Tikz
the geometry of the top eclipse (or circle) is divided by 4 or 8 capacitors (in the symbol as || vertical or horizontal, depends on where it is located. ) It should be either in 2 dimensional or 3 dimensional drawings of the final figures. Any hint will be appreciated.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10397
- Joined: Mon Mar 10, 2008 9:44 pm
draw figure with Tikz
here is a start. I define coordinates using polar coordinates. Then I draw lines and capacitor nodes. For now, I used normal nodes. Capacitors could be drawn manually, such as TikZ double lines.
Code: Select all
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[font=\scriptsize]
\def\height{5}
\def\width{3}
\draw (0, 0) ellipse (\width cm and 1 cm);
\draw (0,-\height ) ellipse (\width cm and 1 cm);
\foreach \i in { 1,...,8 } {
\coordinate (top\i) at (45*\i+138:\width cm and 1cm);
\coordinate [below = \height cm of top\i] (bottom\i);
\coordinate (capacitor-top\i) at (45*\i+158.5:\width cm and 1cm);
\coordinate [below = \height cm of capacitor-top\i]
(capacitor-bottom\i);
}
\foreach \i in { 1,...,5 }
\draw (top\i) -- (bottom\i);
\foreach \i in { 6,...,8 }
\draw [dashed] (top\i) -- (bottom\i);
\foreach \i in { 1,...,8 } {
\node [circle, draw, fill=white, inner sep=1pt]
at (capacitor-top\i) {C};
\node [circle, draw, fill=white, inner sep=1pt]
at (capacitor-bottom\i) {C};
}
\end{tikzpicture}
\end{document}-
beningermany
- Posts: 10
- Joined: Tue Aug 21, 2018 5:55 pm
draw figure with Tikz
Thank you very much for your help. I am still learning node and coordinate. I will show my codes later on.
The codes below is for high pass or low pass circuit.
\documentclass[tikz, margin=15px]{standalone}
\usepackage{color,graphicx,circuitikz}
\usepackage[load-configurations=version-1]{siunitx}
\usetikzlibrary{arrows}
\begin{document}
\begin{circuitikz}[scale=1]
\draw
(0,4)
to [L, l=\small{$L_{j-1,j-1}$}] (4,4)
to [L, *-*,l=\small{$L_{j,j}$}] (8,4)
to [L, l=\small{$L_{j+1,j+1}$}] (12,4)
(0,0)
to [L, l_=\small{$L_{j-1,j-1}$}] (4,0)
to [L, *-*, l_=\small{$L_{j,j}$}] (8,0)
to [L, l_=\small{$L_{j+1,j+1}$}] (12,0) % _ change direciton of letter L
(4,4)
to [L, l=\small{$M_{j,j}$}] (4,2)
to [C, l=\small{$C^{'}_{j}$}] (4,0)
(8,4)
to [L, l=\small{$M_{j+1,j+1}$}] (8,2)
to [C, l=\small{$C^{'}_{j+1}$}] (8,0)
{(2,1.5) node {\small{\color{red}{$I_{j-1}$}}}
(6,1.5) node {\small{\color{red}{$I_{j}$}}}
(10,1.5) node {\small{\color{red}{$I_{j+1}$}}}
};
\draw[thin,red, <-, >=triangle 45] (2,1) arc (-90:90:1);
\draw[thin,red, <-, >=triangle 45] (6,1) arc (-90:90:1);
\draw[thin,red, <-, >=triangle 45] (10,1) arc (-90:90:1);
\end{circuitikz}
\end{document}-
beningermany
- Posts: 10
- Joined: Tue Aug 21, 2018 5:55 pm
draw figure with Tikz
I still have no idea how to make the lines without the method of node.
I can only change the following command
\node [ fill=white, inner sep=1pt] at (capacitor-top\i) {};
\node [circle, draw, fill=white, inner sep=1pt] at (capacitor-bottom\i) {};
which will show ellipse with dashed lines (not precisely). How could you make the lines without the node or coordinate method?
Have a nice weekend!
- Stefan Kottwitz
- Site Admin
- Posts: 10397
- Joined: Mon Mar 10, 2008 9:44 pm
draw figure with Tikz
I defined the nodes so one can refer to them (draw lines between) or place symbols (such as capacitors). Here it is without nodes and without coordinates:beningermany wrote:How could you make the lines without the node or coordinate method?
Code: Select all
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[font=\scriptsize]
\def\height{5}
\def\width{3}
\draw (0, 0) ellipse (\width cm and 1 cm);
\draw (0,-\height ) ellipse (\width cm and 1 cm);
\foreach \i in { 1,...,5 }
\draw (45*\i+138:\width cm and 1cm) -- ++(0,-\height);
\foreach \i in { 6,...,8 }
\draw [dashed] (45*\i+138:\width cm and 1cm) -- ++(0,-\height);
\end{tikzpicture}
\end{document}-
beningermany
- Posts: 10
- Joined: Tue Aug 21, 2018 5:55 pm
draw figure with Tikz
thank you very much for spending time on my question.
I do not understand the following command:
\draw (45*\i+138:\width cm and 1cm) -- ++(0,-\height);
for instance, i=1,
then \draw (183:3cm and 1cm) -- ++ (0,-height)
The definition of polar system: (:r dim), why inside of the command, there are 3 cm and 1 cm , respectively?
I know there is difference, after deleting the 1cm. Could you please explain it to me?
The crucial problem is how to add the symbol of capacitors in the eclipses and on the legs ( lines connecting two eclipse.)
Cheers
Ben
-
beningermany
- Posts: 10
- Joined: Tue Aug 21, 2018 5:55 pm
draw figure with Tikz
for ellipse, therefore, angle: radius1,radius 2
- Stefan Kottwitz
- Site Admin
- Posts: 10397
- Joined: Mon Mar 10, 2008 9:44 pm
draw figure with Tikz
Stefan
-
beningermany
- Posts: 10
- Joined: Tue Aug 21, 2018 5:55 pm
draw figure with Tikz
There will be no confusing any longer. We do not need any circuitikz for the sketch.
The only figures I want to draw are a and b, as showed in the first attachment.
Namely, simple double line will be sufficient to illustrate the capacitor.
There is no need to use the package of circuitikz to draw the capacitor.
Thanks a lot.
good night.
Ben
- Stefan Kottwitz
- Site Admin
- Posts: 10397
- Joined: Mon Mar 10, 2008 9:44 pm
draw figure with Tikz
here is a try. The capacitor is a node style, filled white (overwriting ellipse or edges), with lines drawn at both sides.
Code: Select all
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\makeatletter
\begin{document}
\begin{tikzpicture}[
capacitor/.style = {
fill = white,
inner sep = 0pt,
minimum width = 1.2mm,
minimum height = 5mm,
append after command =
{ (\tikzlastnode.south west) edge[black] (\tikzlastnode.north west)
(\tikzlastnode.south east) edge[black] (\tikzlastnode.north east)} }
]
\def\height{5}
\def\width{3}
\draw (0, 0) ellipse (\width cm and 1 cm);
\draw (0,-\height ) ellipse (\width cm and 1 cm);
\foreach \i in { 1,...,8 } {
\coordinate (top\i) at (45*\i+138:\width cm and 1cm);
\coordinate [below = \height cm of top\i] (bottom\i);
\coordinate (capacitor-top\i) at (45*\i+158.5:\width cm and 1cm);
\coordinate [below = \height cm of capacitor-top\i]
(capacitor-bottom\i);
}
\foreach \i in { 1,...,5 }
\draw (top\i) -- (bottom\i);
\foreach \i in { 6,...,8 }
\draw [dashed] (top\i) -- (bottom\i);
\foreach \i in { 1,...,8 } {
\node [capacitor]
at (capacitor-top\i) {};
\node [capacitor]
at (capacitor-bottom\i) {};
}
\end{tikzpicture}
\end{document}