
두 그래프를 점선으로 연결하는 데 문제가 있습니다. 라텍스 구문은 다음 그림과 같습니다.
\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}