5

I wanna draw a ground with three lines (see Fig. a.), but in circuitikz, the ground is associated with four lines (see Fig. b.). My question is that is it possible to draw a nice ground with three lines in circuitikz or others?

enter image description here

6

It's not too difficult to suppress the fourth line in ground nodes:

\documentclass{article} 
\usepackage{circuitikz}

\makeatletter
\pgfdeclareshape{ground}{
    \anchor{center}{
        \pgfpointorigin
    }
    \behindforegroundpath{      
        \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen

        \pgfscope       
            \pgfpathmoveto{\pgfpointorigin}
            \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
            \pgfusepath{draw}

            \pgfstartlinewidth=\pgflinewidth
            %\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

            \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}}
            \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
            \pgfusepath{draw}

            \pgfsetlinewidth{\pgfstartlinewidth}
            \pgfpathmoveto{\pgfpoint{-.8\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
            \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
            \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
            \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
%           \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
%           \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
            \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}
            \pgfusepath{draw}


            \pgfsetlinewidth{\pgfstartlinewidth}

        \endpgfscope
    }

}
\makeatother

\begin{document}
\begin{circuitikz}
\draw (0,0) node[ground] (g) {};
\end{circuitikz}
\end{document}

enter image description here

4

One can always draw it manually using pure TikZ:

\documentclass{article}
\usepackage{subcaption}
\usepackage{tikz}
\begin{document}
\begin{figure}[htbp]
    \centering
    \begin{subfigure}[t]{2cm}
        \centering
        \begin{tikzpicture}
            \draw (0,0)--(0,1) (0,1.2)--(0,2.2);
            \draw[thick] (-.3,1.2)--(.3,1.2) (-.3,1)--(.3,1);
            \draw (-.2,0)--(.2,0) (-.125,-.1)--(.125,-.1) (-.05,-.2)--(.05,-.2);
        \end{tikzpicture}
        \caption{}
    \end{subfigure}
    \begin{subfigure}[t]{2cm}
        \centering
        \begin{tikzpicture}
            \draw (0,0)--(0,1) (0,1.2)--(0,2.2);
            \draw[thick] (-.3,1.2)--(.3,1.2) (-.3,1)--(.3,1);
            \draw (-.2,0)--(.2,0) (-.15,-.1)--(.15,-.1) (-.1,-.2)--(.1,-.2) (-.05,-.3)--(.05,-.3);
        \end{tikzpicture}
        \caption{}
    \end{subfigure}
    \caption{}
    \label{fig:my_label}
\end{figure}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.