PNG 이미지를 통한 CircuiTikZ

PNG 이미지를 통한 CircuiTikZ

.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$(이 두 기호는 서로 조금 더 떨어져 있는데, 내가 얻는 결과와는 다릅니다).

답변1

가장 먼저.절대둥지 tikzpictures! 그리고 기본 사진을 게시하세요. 이 경우에는 김프를 사용하여 uffa.png.

여기에 이미지 설명을 입력하세요

내 접근 방식은 다음과 같습니다.

  1. 의 시작 부분에 이미지를 노드로 로드하면 tikzpicture그 위에 쓸 수 있습니다.
  2. 쉽게 참조할 수 있도록 일종의 그리드를 설정하십시오.
  3. 원하는 대로 그려서 좌표를 미세 조정하세요.
  4. 그리드를 제거하십시오.

살펴보겠습니다. 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}

그리드와 회로가 있는

결과를 얻기 위해 조정해야 하는 숫자의 수를 최소화하기 위해 가능한 경우 상대 좌표와 명명된 좌표를 사용하려고 했습니다. 그런 다음 그리드를 제거하면 다음과 같은 결과가 나타납니다.

최종 출력

관련 정보