Hi, I am just beginning to learn Tikz/PGF. However, I have trouble drawing some complicated figures. Is there anyone who can give me some tips?
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.
LaTeX forum ⇒ Graphics, Figures & Tables ⇒ draw figure with Tikz
-
- Posts: 10
- Joined: Tue Aug 21, 2018 5:55 pm
draw figure with Tikz
- Attachments
-
- birdcage.png (25.1 KiB) Viewed 637 times
- Stefan Kottwitz
- Site Admin
- Posts: 9281
- Joined: Mon Mar 10, 2008 9:44 pm
Hi,
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.
Stefan
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.
\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}
Stefan
Site admin
-
- Posts: 10
- Joined: Tue Aug 21, 2018 5:55 pm
I found another figure. the circuits ( b and d) I could make it. here I want to show the code.
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.
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}
Last edited by beningermany on Sun Aug 26, 2018 10:52 pm, edited 1 time in total.
-
- Posts: 10
- Joined: Tue Aug 21, 2018 5:55 pm
Hi, Stefan,
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!
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!
- Attachments
-
- highpass.png (30.94 KiB) Viewed 585 times
- Stefan Kottwitz
- Site Admin
- Posts: 9281
- Joined: Mon Mar 10, 2008 9:44 pm
beningermany wrote:How could you make the lines without the node or coordinate method?
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:
\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}
Stefan
Site admin
-
- Posts: 10
- Joined: Tue Aug 21, 2018 5:55 pm
Hi Stefan,
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
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
-
- Posts: 10
- Joined: Tue Aug 21, 2018 5:55 pm
finally, I know " \draw (45*\i+138:\width cm and 1cm) -- ++(0,-\height); "
for ellipse, therefore, angle: radius1,radius 2
for ellipse, therefore, angle: radius1,radius 2
- Stefan Kottwitz
- Site Admin
- Posts: 9281
- Joined: Mon Mar 10, 2008 9:44 pm
I can take a look at drawing capacitors, perhaps tomorrow, as it gets night here. If not using the circuitikz library, it could be a simple double line (white filled to overprint the ellipse).
Stefan
Stefan
Site admin
-
- Posts: 10
- Joined: Tue Aug 21, 2018 5:55 pm
Hi Stefan,
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
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: 9281
- Joined: Mon Mar 10, 2008 9:44 pm
Hi Ben,
here is a try. The capacitor is a node style, filled white (overwriting ellipse or edges), with lines drawn at both sides.
Stefan
here is a try. The capacitor is a node style, filled white (overwriting ellipse or edges), with lines drawn at both sides.
\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}
Stefan
Site admin
Return to “Graphics, Figures & Tables”
Who is online
Users browsing this forum: No registered users and 6 guests