2つの異なる地面を描く方法

2つの異なる地面を描く方法

3 本の線で地面を描きたいのですが (図 a を参照)、 ではcircuitikz地面は 4 本の線に関連付けられています (図 b を参照)。 質問は、 または他の で 3 本の線できれいな地面を描くことは可能でしょうかcircuitikz?

ここに画像の説明を入力してください

答え1

groundノードの 4 行目を抑制するのはそれほど難しくありません。

\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}

ここに画像の説明を入力してください

答え2

手動で描くこともできます純粋なティZ:

\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}

ここに画像の説明を入力してください

関連情報