
.png 画像の上にシンプルな CircuiTikZ シンボルを描画したいです。これが私が望んでいるものです:
現在私が得ているものは次のとおりです:
これが私のコードです:
\begin{figure} [!ht]
\begin{tikzpicture}[x=1cm,y=1cm]
\node at (0,0) {\includegraphics[trim={40cm 55cm 40cm 55cm},clip,height=10cm]{images/MecanismoEscala_primer_ensayo_Variables.png}};
\node at (-3.7634,-1.5117){
\begin{circuitikz}
\draw
(0,0) --++ (-1.0778,0)
to [open,v=$v$,o-o] ++(0,0.7012)
to[short,i=$i_{a}$] ++(1.0663,0);
\end{circuitikz}
};
\end{tikzpicture}
\end{figure}\FloatBarrier
また、+- 記号と一緒に端子の横に も書きたいと思います$v$
(この 2 つの記号は、私が得た結果とは異なり、互いに少し離して書きます)。
答え1
初めに。一度もないネスト tikzpictures! そして、今回は GIMP で作成して として保存した基本画像を投稿しますuffa.png
。
私のアプローチは次のようになります:
- の先頭に画像をノードとして読み込み
tikzpicture
、その上に書き込むことができるようにします。 - 簡単に参照できるように、何らかのグリッドを設定します。
- 好きなものを描いて、座標を微調整します。
- グリッドを削除します。
見てみましょう: ステップ 1 と 2 は次のようになります:
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {%
\includegraphics[width=10cm]{uffa.png}};
\draw[red,thin] (0,0) grid[step=1] (10,5);
\end{tikzpicture}
\end{document}
左下の点にあり0,0
、各グリッド ステップは 1cm です。現在、背景は白ではありません (印刷しないでください。印刷しない場合は変更してください)。そのため、RGB が 33、40、48 の非常に暗い青灰色になる色を選択しました (どのカラー ピッカーでもかまいません)。
次に、開いた極を青灰色で塗りつぶして回路を描きます。
\documentclass[tikz]{standalone}
\usepackage[RPvoltages, american]{circuitikz}
\begin{document}
\begin{tikzpicture}[color=white]% write in white
\node[anchor=south west,inner sep=0] (image) at (0,0) {%
\includegraphics[width=10cm]{uffa.png}};
\draw[red,thin] (0,0) grid[step=1] (10,5);
\definecolor{mybg}{RGB}{33,40,48}% with a color picker
\ctikzset{open poles fill=mybg}% tell circuitikz what is background for you
\draw (4,4) coordinate(a) to[short, i=$i_a$, o-] ++(1.8,0);
\draw (a) ++(0,-1) to[short, o-] ++(1.7,0);
\draw (a) ++(-0.3,0) to[open, v=$v$] ++(0,-1);
\end{tikzpicture}
\end{document}
結果を得るために調整する必要がある数値の数を最小限に抑えるために、可能な限り相対座標と名前付き座標を使用するようにしました。次に、グリッドを削除すると次のようになります。