
今日の私の問題は、電気回路(主に \draw を使用して描画)を Tikz 軸に適合させることです。
私は Axis コマンドを使用して、一連の点から曲線をプロットしています (\addplot を使用) (これまでのところ問題はありません)。しかし、Tikzpicture がアンカーなどをどのように処理して、暴走せずに所定の位置に留まるようにするのかがわかりません。
わかりやすくするために、3 つの軸を作成するコードを以下に示します (必要に応じて 3 つのサブ図を作成します。上部に 2 つ、左下に 1 つ)。
\begin{tikzpicture}[scale=1]
% Vs(ve) graphique
\begin{axis}[name=plot1
]
\addplot[black] table {Fig_ELA2/ELA2_P3_C3/ELA2_P3_C1_PP_CLASSE_B/courbes/vs_ve_out.txt};
\end{axis}
% Vs(wt) graphique
\begin{axis}[name=plot2,at={($(plot1.east)+(1.5cm,0)$)},anchor=west
]
\addplot[black] table {Fig_ELA2/ELA2_P3_C3/ELA2_P3_C1_PP_CLASSE_B/courbes/vs_t_out.txt};
\end{axis}
% Ve(wt) graphique
\begin{axis}[name=plot3,at={($(plot1.south)-(0,1.5cm)$)},anchor=north
]
\addplot[black] table {Fig_ELA2/ELA2_P3_C3/ELA2_P3_C1_PP_CLASSE_B/courbes/ve_t_out.txt};
\end{axis}
% Electrical circuit
\draw
(0,0) node[njfet](J){$J$}
(J.S) to[short,-o] ++(0,-0.1) node[left](S){\tiny S} to [R, l_=$R_S$,-*] (0,-3) node(gnd_rs)[ground]{}
(J.D) to[short,-o] ++(0,0.3) node[left](D){\tiny D} to [R, l=$R_D$] ++(0,2) node[vcc]{\color{green} $V_{CC}$}
(J.G) to[short,-o] ++(-0.1,0) node[above](G){\tiny G}-- ++(-1,0) node(RG){}
;
\coordinate (gnd_rg) at (RG|-gnd_rs);
\draw (RG) to [R, l_=$R_G$,-*] (gnd_rg);
\draw (gnd_rs) to[short,-o] ++(-4,0) node(gnd_ve){};
\draw (gnd_rs) to[short,-*] ++(1,0) node(gnd_cs){} to[short,-o] ++(2,0) node(gnd_vs){};
\coordinate (ve) at (gnd_ve|-J.G);
\draw (ve) to[C,l=$C_{Le}$,o-*] (RG);
\coordinate (vs) at (gnd_vs|-D);
\draw (D) to[C,l=$C_{Ls}$,-o] (vs);
\coordinate (cs) at (S-|gnd_cs);
\draw (S) -- (cs) to[C,l=$C_S$,] (gnd_cs);
\draw[-triangle 45, red] (gnd_vs) -- (vs) node[right,pos=0.5]{$v_s(t)$};
\draw[-triangle 45, red] (gnd_ve) -- (ve) node[left,pos=0.5]{$v_e(t)$};
\end{tikzpicture}
テスト用の曲線を提供しなかったことをお詫びします。単に愚かな曲線を作成すればよいと思います (または addplot をまったく使用しない)。
では、何らかの方法で電気回路を絶対として設定し、CSS で絶対のように動作させる (つまりフローから外す) 方法はあるのでしょうか。
助けてくれてありがとう !
答え1
常に自己完結的な例を投稿するように努めてください。そうすれば、支援したい人は、あなたの前文や定義を推測することなく支援することができます。とはいえ、これは選択肢の 1 つです --- 次の点に注意してください:
- あなたの回路には、
(0,-3)
最初の行の という絶対座標が 1 つだけあります。これを修正しました (そして、あなたの回路を変換できなくなりました)。 - それでも回路はかなり大きいので、
scope
環境に合わせてスケーリングしました。
つまり、次のようなことができます (++(6,-5)
手動で調整します。より自動化することも可能ですが、それはまた別の話で、別の日に説明します...)
\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\usepackage{pgfplots}\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}[scale=1]
% Vs(ve) graphique
\begin{axis}[name=plot1
]
\addplot[black] {sin(x)};
\end{axis}
% Vs(wt) graphique
\begin{axis}[name=plot2,at={($(plot1.east)+(1.5cm,0)$)},anchor=west
]
\addplot[black] {cos(x)};
\end{axis}
% Ve(wt) graphique
\begin{axis}[name=plot3,at={($(plot1.south)-(0,1.5cm)$)},anchor=north
]
\addplot[black] {x};
\end{axis}
% Electrical circuit
\begin{scope}[scale=0.8, transform shape]
\draw
(plot1.south east) ++(6,-5) node[njfet](J){$J$}
(J.S) to[short,-o] ++(0,-0.1) node[left](S){\tiny S} to [R, l_=$R_S$,-*] ++(0,-3) node(gnd_rs)[ground]{}
(J.D) to[short,-o] ++(0,0.3) node[left](D){\tiny D} to [R, l=$R_D$] ++(0,2) node[vcc]{\color{green} $V_{CC}$}
(J.G) to[short,-o] ++(-0.1,0) node[above](G){\tiny G}-- ++(-1,0) node(RG){}
;
\coordinate (gnd_rg) at (RG|-gnd_rs);
\draw (RG) to [R, l_=$R_G$,-*] (gnd_rg);
\draw (gnd_rs) to[short,-o] ++(-4,0) node(gnd_ve){};
\draw (gnd_rs) to[short,-*] ++(1,0) node(gnd_cs){} to[short,-o] ++(2,0) node(gnd_vs){};
\coordinate (ve) at (gnd_ve|-J.G);
\draw (ve) to[C,l=$C_{Le}$,o-*] (RG);
\coordinate (vs) at (gnd_vs|-D);
\draw (D) to[C,l=$C_{Ls}$,-o] (vs);
\coordinate (cs) at (S-|gnd_cs);
\draw (S) -- (cs) to[C,l=$C_S$,] (gnd_cs);
\draw[->, red] (gnd_vs) -- (vs) node[right,pos=0.5]{$v_s(t)$};
\draw[->, red] (gnd_ve) -- (ve) node[left,pos=0.5]{$v_e(t)$};
\end{scope}
\end{tikzpicture}
\end{document}