Usando o seguinte código da resposta paraessa questão
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{calc}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{}
\begin{tikzpicture}[scale=.8, transform shape, -|/.style args={of #1 at #2}{insert path={(intersection cs:first line={#1}, second line={(#2,0)--(#2,10)}) coordinate (aux) (#2,0) |- (0,0|-aux) }}, vert/.style args={of #1 at #2}{insert path={(#2,0) -- (intersection cs:first line={#1}, second line={(#2,0)--(#2,10)}) }}]% this is used when drawing 2 lines to intersect with
\pgfmathsetmacro{\incrmnty}{1.}
\pgfmathsetmacro{\incrmntx}{2.}
\pgfmathsetmacro{\xlab}{2006}
\pgfmathsetmacro{\xn}{5}
\pgfmathsetmacro{\yn}{5}
\begin{scope}[xshift=0cm, yshift=0cm]
\draw [thick](0,0) -- (\incrmntx*\xn+\incrmntx*1,0);
\node at (\incrmntx*\xn+\incrmntx*1,\incrmnty*\yn-.4) (endx){};
\draw [thick](0,0) -- (0,\incrmnty*\yn);
\end{scope}
\begin{scope}[xshift=0cm, yshift=0cm]
\foreach \x [evaluate=\x as \aff using int(\xlab+(1*\x))] in {0,...,\xn}{\draw [black!40!white] (\incrmntx*\x+\incrmntx*.4,0) node [black, xshift=0cm, yshift=-.68cm, font=\footnotesize] {\aff} -- +(-90:.2);}
\end{scope}
\draw[blue!40!black, densely dashed, line width=.4mm] (-.1*\incrmntx,1.56*\incrmnty) node [black, left, yshift=-.06cm] {Intercept} -- (endx.center);
\draw[blue!80!white, thick, dashed, -|={of {(-.1*\incrmntx,1.56*\incrmnty)--(endx.center)} at {\incrmntx*\xn+\incrmntx*.4}}] node [black, left, yshift=.06cm] {2011 value};
\draw[blue!80!white, thick, dashed, -|={of {(-.1*\incrmntx,1.56*\incrmnty)--(endx.center)} at {\incrmntx*\xn-2+\incrmntx*.4}}] node [black, left, yshift=-.06cm] {2010 value};
\draw[blue!80!white, thick, dashed, vert={of {(-.1*\incrmntx,1.56*\incrmnty)--(endx.center)} at {\incrmntx*\xn-4+\incrmntx*.4}}];
\draw[red!80!white, thick] (\incrmntx*\xn-7+\incrmntx*.4,2.58*\incrmnty) -- (\incrmntx*\xn-10+\incrmntx*.4,2.58*\incrmnty) node [black, xshift=.6cm, yshift=.3cm] {Slope} -- +(-90:.82cm);
\end{tikzpicture}
\end{frame}
\end{document}
Como fazer as seguintes modificações:
Modificando o estilo para desenhar apenas uma linha oblíqua, em vez de duas
Desenhar a linha vermelha da intersecção do local especificado com a linha oblíqua (um ponto entre 2007 e 2008) até o local especificado final (em 2006)
Responder1
Aqui está um estilo hat
para abordar o segundo ponto. O primeiro ponto eu, infelizmente, não entendo. O que você quer dizer com "desenhar apenas uma linha oblíqua, em vez de duas", ou seja, a quais duas linhas você está se referindo?
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{calc}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{}
\begin{tikzpicture}[scale=.8, transform shape,
-|/.style args={of #1 at #2}{insert path={(intersection cs:first line={#1}, second line={(#2,0)--(#2,10)}) coordinate (aux) (#2,0) |- (0,0|-aux) }},
vert/.style args={of #1 at #2}{insert path={(#2,0) -- (intersection cs:first
line={#1}, second line={(#2,0)--(#2,10)}) }},
hat/.style args={of #1 at #2 and #3}{insert path={%
(intersection cs:first line={#1}, second line={(#2,0)--(#2,10)}) |-
(intersection cs:first line={#1}, second line={(#3,0)--(#3,10)})
}}
]% this is used when drawing 2 lines to intersect with
\pgfmathsetmacro{\incrmnty}{1.}
\pgfmathsetmacro{\incrmntx}{2.}
\pgfmathsetmacro{\xlab}{2006}
\pgfmathsetmacro{\xn}{5}
\pgfmathsetmacro{\yn}{5}
\begin{scope}[xshift=0cm, yshift=0cm]
\draw [thick](0,0) -- (\incrmntx*\xn+\incrmntx*1,0);
\node at (\incrmntx*\xn+\incrmntx*1,\incrmnty*\yn-.4) (endx){};
\draw [thick](0,0) -- (0,\incrmnty*\yn);
\end{scope}
\begin{scope}[xshift=0cm, yshift=0cm]
\foreach \x [evaluate=\x as \aff using int(\xlab+(1*\x))] in {0,...,\xn}{\draw [black!40!white] (\incrmntx*\x+\incrmntx*.4,0) node [black, xshift=0cm, yshift=-.68cm, font=\footnotesize] {\aff} -- +(-90:.2);}
\end{scope}
\draw[blue!40!black, densely dashed, line width=.4mm] (-.1*\incrmntx,1.56*\incrmnty) node [black, left, yshift=-.06cm] {Intercept} -- (endx.center);
\draw[blue!80!white, thick, dashed, -|={of {(-.1*\incrmntx,1.56*\incrmnty)--(endx.center)} at {\incrmntx*\xn+\incrmntx*.4}}] node [black, left, yshift=.06cm] {2011 value};
\draw[blue!80!white, thick, dashed, -|={of {(-.1*\incrmntx,1.56*\incrmnty)--(endx.center)} at {\incrmntx*\xn-2+\incrmntx*.4}}] node [black, left, yshift=-.06cm] {2010 value};
\draw[blue!80!white, thick, dashed, vert={of {(-.1*\incrmntx,1.56*\incrmnty)--(endx.center)} at {\incrmntx*\xn-4+\incrmntx*.4}}];
\draw[red!80!white, thick,hat={of {(-.1*\incrmntx,1.56*\incrmnty)--(endx.center)}
at {\incrmntx*\xn-10+\incrmntx*.4} and {\incrmntx*\xn-7+\incrmntx*.4}}]
node[black,pos=0.55,above right]{Slope};
\end{tikzpicture}
\end{frame}
\end{document}