tikz:使用线条、点和注释创建简单图表

tikz:使用线条、点和注释创建简单图表

我想知道如何在 LaTeX 中为投影仪幻灯片绘制以下图形。在此处输入图片描述

我尝试使用以下代码。但是,我不知道如何获取线条的点。我该如何包含它们?

\begin{tikzpicture}[scale=0.9, transform shape]
%\draw[step=0.5cm,gray,very thin] (0,0) grid (4,3);
\draw[->] (0,0) -- (4,0) ; 
\draw[->] (0,0) -- (0,3) ; 
\draw[-] (1,2) -- (3,1.5); 
\draw[dotted] (1,1) -- (3,0.5); 
\draw[-] (1,1) -- (3,1.25);
\draw[->] (2.5,2.5) -- (2.15,1.8);
\draw[->] (1.6,1.5) -- (2,1.25); 
\draw[->] (1.5,0.5) -- (2,0.65); 
\draw[decoration={brace},decorate]
(3.1,1.25) -- node[right] {{\tiny Treatment Effect}} (3.1,0.5);
\node at (4,-0.25) {\scriptsize\textbf{Time}};
\node at (-0.35,3.25) {\scriptsize\textbf{Employment}};
\node at (-0.35,3) {\scriptsize\textbf{Rate}};
\node at (1,-0.25) {\scriptsize\textbf{Before}};
\node at (3,-0.25) {\scriptsize\textbf{After}};
\node at (3,2.75) {\tiny\textbf{employment trend}};
\node at (3,2.6) {\tiny\textbf{in control state}};
\node at (0.85,1.6) {\tiny\textbf{employment trend}};
\node at (0.85,1.45) {\tiny\textbf{in treatment state}};
\node at (0.85,0.5) {\tiny\textbf{counterfactual}};
\end{tikzpicture}

答案1

我按照如下方式进行操作:

\begin{tikzpicture}[scale=0.9, transform shape]
%\draw[step=0.5cm,gray,very thin] (0,0) grid (4,3);
\draw[->] (0,0) -- (4,0) ; 
\draw[->] (0,0) -- (0,3) ; 
\draw[-] (1,2) -- (3,1.5); 
\draw[dotted] (1,1) -- (3,0.5); 
\draw[-] (1,1) -- (3,1.25);
\draw[->] (2.5,2.5) -- (2.15,1.8);
\draw[->] (1.6,1.5) -- (2,1.25); 
\draw[->] (1.5,0.5) -- (2,0.65); 
\draw[-] (1,0.05) -- (1,-0.05);
\draw[-] (3,0.05) -- (3,-0.05);
\draw[decoration={brace},decorate]
(3.1,1.25) -- node[right] {{\tiny Treatment Effect}} (3.1,0.5);
\node at (4,-0.25) {\scriptsize\textbf{Time}};
\node at (-0.35,3.25) {\scriptsize\textbf{Employment}};
\node at (-0.35,3) {\scriptsize\textbf{Rate}};
\node at (1,-0.25) {\scriptsize\textbf{Before}};
\node at (3,-0.25) {\scriptsize\textbf{After}};
\node at (3,2.75) {\tiny\textbf{employment trend}};
\node at (3,2.6) {\tiny\textbf{in control state}};
\node at (0.85,1.6) {\tiny\textbf{employment trend}};
\node at (0.85,1.45) {\tiny\textbf{in treatment state}};
\node at (0.85,0.5) {\tiny\textbf{counterfactual}};
\fill (1,1) circle[radius=1pt];
\fill (3,0.5) circle[radius=1pt]; 
\fill (3,1.5) circle[radius=1pt]; 
\fill (3,1.25) circle[radius=1pt]; 
\fill (1,2) circle[radius=1pt]; 
\end{tikzpicture}

相关内容