
2 つのグラフを点線で接続する際に問題があります。LaTeX 構文は以下の図のとおりです。
\begin{figure}[h]
\centering
\begin{subfigure}[b]{0.4\linewidth}
\begin{tikzpicture}
\draw[->] (-0.5, 0) -- (4, 0) node[right] {$M$};
\draw[->] (0, -0.5) -- (0, 4) node [above] {$i$};
\draw (1.5, 0) -- (1.5, 3.75) node [above] {$M_s$}
\draw (2.5, 0) -- (2.5, 3.75) node [above] {$M_s'$}
\draw (0.5, 4) to [bend right =45] (4, 0.5) node[right] {$L$}
\end{tikzpicture}
\caption{1} \label{fig:my_label1}
\end{subfigure}
\begin{subfigure}[b]{0.4\linewidth}
\begin{tikzpicture}
\draw[->] (-0.5,0) -- (4,0) node[right] {$I$};
\draw[->] (0,-0.5) -- (0,4) node[above] {$r$};
\draw (0.5, 4) to [bend right =45] (4, 0.5) node[right] {$r$}
\end{tikzpicture}
\caption{Interaction} \label{fig:M2}
\end{subfigure}
\caption{Ravnotežni obseg investicij}
\end{figure}
答え1
ようこそ!そのためにoverlay
はremember
画像が必要ですが、おそらく交差を計算する必要もあります。次のコードはそれを実行し、コード内のエラーを修正してコンパイル可能な例に完成させます。
\documentclass{article}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{figure}[h]
\centering
\begin{subfigure}[b]{0.45\linewidth}
\begin{tikzpicture}[remember picture]
\draw[->] (-0.5, 0) -- (4, 0) node[right] {$M$};
\draw[->] (0, -0.5) -- (0, 4) node [above] {$i$};
\draw[name path=vert1] (1.5, 0) -- (1.5, 3.75) node [above] {$M_s$};
\draw (2.5, 0) -- (2.5, 3.75) node [above] {$M_s'$};
\draw[name path=curve1] (0.5, 4) to [bend right=45] (4, 0.5) node[right] {$L$};
\path[name intersections={of=vert1 and curve1,by=i1}] (0,0) coordinate (O1);
\end{tikzpicture}
\caption{1}
\label{fig:my_label1}
\end{subfigure}\qquad
\begin{subfigure}[b]{0.45\linewidth}
\begin{tikzpicture}[remember picture]
\draw[->] (-0.5,0) -- (4,0) node[right] {$I$} coordinate (x2);
\draw[->] (0,-0.5) -- (0,4) node[above] {$r$};
\draw[name path=curve2] (0.5, 4) to [bend right =45] (4, 0.5) node[right] {$r$};
\path[overlay,name path=hori] (O1|-i1) -- (x2|-i1);
\draw[name intersections={of=hori and curve2,by=i2},overlay,densely dotted]
(O1|-i1) --(i2);
\end{tikzpicture}
\caption{Interaction}
\label{fig:M2}
\end{subfigure}
\caption{Ravnotezni obseg investicij.}
\end{figure}
\end{document}