
Ich habe ein Problem damit, zwei Graphen mit gepunkteten Linien zu verbinden. Die Latex-Syntax ist unten abgebildet.
\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}
Antwort1
Willkommen! Du brauchst dafür ein Bild, aber wahrscheinlich musst du auch die Schnittpunkte berechnen. Der folgende Code erledigt das, behebt Fehler in deinem Code und vervollständigt ihn zu einem kompilierbaren Beispiel 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}